diff --git a/CMakeLists.txt b/CMakeLists.txt index a38654956aa0de27938a579247487edad4b3e2da..b4de70a283d94a2aa6edea6c5ff6e8247a027d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,9 +56,9 @@ ENDIF() SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel") -# MAX_INDEXES - Set the maximum number of indexes per table, default 64U +# MAX_INDEXES - Set the maximum number of indexes per table, default 64 IF (NOT MAX_INDEXES) - SET(MAX_INDEXES 64U) + SET(MAX_INDEXES 64) ENDIF(NOT MAX_INDEXES) IF (${MAX_INDEXES} GREATER 128) diff --git a/CREDITS b/CREDITS index 6288c2cdea415a9d620de715a909ce3dc78a0065..7572f6f5dd92ed21b2bb850e19438463a4203dc2 100644 --- a/CREDITS +++ b/CREDITS @@ -3,8 +3,9 @@ organization registered in the USA. The current main sponsors of the MariaDB Foundation are: -Alibaba Cloud https://intl.aliyun.com (2017) +Alibaba Cloud https://www.alibabacloud.com/ (2017) Booking.com https://www.booking.com (2013) +Microsoft https://microsoft.com/ (2017) Tencent Cloud https://cloud.tencent.com (2017) Development Bank of Singapore https://dbs.com (2016) IBM https://www.ibm.com (2017) diff --git a/Docs/INFO_SRC b/Docs/INFO_SRC index 3dcb9a5dc7dbb53e1d00db1838fcc32fdfc8b9dc..bd70a3ac3c386014982a94db825349833320190e 100644 --- a/Docs/INFO_SRC +++ b/Docs/INFO_SRC @@ -1,8 +1,8 @@ -commit: 461cf3e5a3c2d346d75b1407b285f8daf9d01f67 -date: 2017-12-21 17:40:01 +0200 -build-date: 2017-12-21 15:48:56 +0000 -short: 461cf3e +commit: aba15b864af664276261dcbbdaef35268d407af1 +date: 2018-02-04 04:28:14 +0200 +build-date: 2018-02-04 02:30:32 +0000 +short: aba15b8 branch: HEAD -MariaDB source 10.1.30 +MariaDB source 10.1.31 diff --git a/VERSION b/VERSION index 466fdaeb91ded8fdd6e870847cac1fd2613adbc3..244d28b6ba5970687c1fae7514bcbb8b468aeeb2 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=1 -MYSQL_VERSION_PATCH=30 +MYSQL_VERSION_PATCH=31 diff --git a/client/mysql.cc b/client/mysql.cc index 977085ebd425df83e82b66bd87a1891279fe46f2..7973c3c7fc39a50f528e64a22083cac7391f081a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1140,6 +1140,7 @@ int main(int argc,char *argv[]) current_prompt = my_strdup(default_prompt,MYF(MY_WME)); prompt_counter=0; aborted= 0; + sf_leaking_memory= 1; /* no memory leak reports yet */ outfile[0]=0; // no (default) outfile strmov(pager, "stdout"); // the default, if --pager wasn't given @@ -1200,6 +1201,7 @@ int main(int argc,char *argv[]) my_end(0); exit(1); } + sf_leaking_memory= 0; glob_buffer.realloc(512); completion_hash_init(&ht, 128); init_alloc_root(&hash_mem_root, 16384, 0, MYF(0)); @@ -1795,10 +1797,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #ifndef EMBEDDED_LIBRARY if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, opt->name)) <= 0) - { - sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); - } #endif break; case OPT_SERVER_ARG: @@ -4593,8 +4592,11 @@ static char *get_arg(char *line, get_arg_mode mode) } for (start=ptr ; *ptr; ptr++) { - if ((*ptr == '\\' && ptr[1]) || // escaped character - (!short_cmd && qtype && *ptr == qtype && ptr[1] == qtype)) // quote + /* if short_cmd use historical rules (only backslash) otherwise SQL rules */ + if (short_cmd + ? (*ptr == '\\' && ptr[1]) // escaped character + : (*ptr == '\\' && ptr[1] && qtype != '`') || // escaped character + (qtype && *ptr == qtype && ptr[1] == qtype)) // quote { // Remove (or skip) the backslash (or a second quote) if (mode != CHECK) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 2200462b2fe285c7b93085604056e684e6770c88..844a2d7bbf8daf8fef925dd390a9de85c7ed8c66 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1523,7 +1523,6 @@ static void cleanup_and_exit(int exit_code) } } - sf_leaking_memory= 0; /* all memory should be freed by now */ exit(exit_code); } @@ -7294,10 +7293,7 @@ get_one_option(int optid, const struct my_option *opt, char *argument) #ifndef EMBEDDED_LIBRARY if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, opt->name)) <= 0) - { - sf_leaking_memory= 1; /* no memory leak reports here */ exit(1); - } #endif break; case '?': diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index c07de46fc1675a77611df69619032a4619d23855..04860a40dbbbcb27407c2daf0e1da004568c8a80 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -1,4 +1,5 @@ # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2018, 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 diff --git a/config.h.cmake b/config.h.cmake index 8ef512c70718e9a682cf089b269aea8e512fadd5..b1a9d813767712e6f7eab1ff9c32978bb11c9759 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -150,6 +150,7 @@ #cmakedefine HAVE_CUSERID 1 #cmakedefine HAVE_CXX_NEW 1 #cmakedefine HAVE_DIRECTIO 1 +#cmakedefine HAVE_DLADDR 1 #cmakedefine HAVE_DLERROR 1 #cmakedefine HAVE_DLOPEN 1 #cmakedefine HAVE_DOPRNT 1 diff --git a/configure.cmake b/configure.cmake index 0057c7fb1003e1aa7aa41c1c47569772230ee39d..a1cddbb37fa69a3cca14e5e7f38da45d9c941210 100644 --- a/configure.cmake +++ b/configure.cmake @@ -344,6 +344,7 @@ CHECK_FUNCTION_EXISTS (ftruncate HAVE_FTRUNCATE) CHECK_FUNCTION_EXISTS (getline HAVE_GETLINE) CHECK_FUNCTION_EXISTS (compress HAVE_COMPRESS) CHECK_FUNCTION_EXISTS (crypt HAVE_CRYPT) +CHECK_FUNCTION_EXISTS (dladdr HAVE_DLADDR) CHECK_FUNCTION_EXISTS (dlerror HAVE_DLERROR) CHECK_FUNCTION_EXISTS (dlopen HAVE_DLOPEN) CHECK_FUNCTION_EXISTS (fchmod HAVE_FCHMOD) @@ -407,7 +408,6 @@ CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK) CHECK_FUNCTION_EXISTS (pthread_threadmask HAVE_PTHREAD_THREADMASK) CHECK_FUNCTION_EXISTS (pthread_yield_np HAVE_PTHREAD_YIELD_NP) CHECK_FUNCTION_EXISTS (putenv HAVE_PUTENV) -CHECK_FUNCTION_EXISTS (readdir_r HAVE_READDIR_R) CHECK_FUNCTION_EXISTS (readlink HAVE_READLINK) CHECK_FUNCTION_EXISTS (re_comp HAVE_RE_COMP) CHECK_FUNCTION_EXISTS (regcomp HAVE_REGCOMP) @@ -465,6 +465,16 @@ IF(HAVE_SYS_EVENT_H) CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE) ENDIF() +# readdir_r might exist, but be marked deprecated +SET(CMAKE_REQUIRED_FLAGS -Werror) +CHECK_CXX_SOURCE_COMPILES( +"#include +int main() { + readdir_r(0,0,0); + return 0; + }" HAVE_READDIR_R) +SET(CMAKE_REQUIRED_FLAGS) + #-------------------------------------------------------------------- # Support for WL#2373 (Use cycle counter for timing) #-------------------------------------------------------------------- diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 437fc4aa7f917789a799f702f6ff69d259c7c43a..2228e542dc71d13f263c67cb0c3cccc591c2ee8c 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1183,10 +1183,10 @@ debug_sync_point(const char *name) } static const char *xb_client_default_groups[]= - { "xtrabackup", "client", 0, 0, 0 }; + { "xtrabackup", "mariabackup", "client", 0, 0, 0 }; static const char *xb_server_default_groups[]= - { "xtrabackup", "mysqld", 0, 0, 0 }; + { "xtrabackup", "mariabackup", "mysqld", 0, 0, 0 }; static void print_version(void) { @@ -1213,7 +1213,7 @@ GNU General Public License for more details.\n\ \n\ You can download full text of the license on http://www.gnu.org/licenses/gpl-2.0.txt\n"); - printf("Usage: [%s [--defaults-file=#] --backup | %s [--defaults-file=#] --prepare] [OPTIONS]\n",my_progname,my_progname); + printf("Usage: %s [--defaults-file=#] [--backup | --prepare | --copy-back | --move-back] [OPTIONS]\n",my_progname); print_defaults("my", xb_server_default_groups); my_print_help(xb_client_options); my_print_help(xb_server_options); @@ -2698,7 +2698,7 @@ xtrabackup_scan_log_recs( if (srv_encrypt_log) { log_encrypt_before_write(scanned_checkpoint_no, - log_sys->buf, write_size); + log_sys->buf, start_lsn, write_size); } if (ds_write(dst_log_file, log_sys->buf, write_size)) { @@ -4246,16 +4246,11 @@ xtrabackup_init_temp_log(void) ib_int64_t file_size; - lsn_t max_no; - lsn_t max_lsn; - lsn_t checkpoint_no; + lsn_t max_no = 0; + lsn_t max_lsn = 0; ulint fold; - bool checkpoint_found; - - max_no = 0; - if (!log_buf) { goto error; } @@ -4354,35 +4349,29 @@ xtrabackup_init_temp_log(void) // ' ', 4); } - checkpoint_found = false; - /* read last checkpoint lsn */ for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { if (!recv_check_cp_is_consistent(const_cast (log_buf + field))) - goto not_consistent; + continue; - checkpoint_no = mach_read_from_8(log_buf + field + - LOG_CHECKPOINT_NO); + lsn_t checkpoint_no = mach_read_from_8(log_buf + field + + LOG_CHECKPOINT_NO); if (checkpoint_no >= max_no) { max_no = checkpoint_no; max_lsn = mach_read_from_8(log_buf + field + LOG_CHECKPOINT_LSN); - checkpoint_found = true; } -not_consistent: - ; } - if (!checkpoint_found) { + if (!max_lsn) { msg("mariabackup: No valid checkpoint found.\n"); goto error; } - /* It seems to be needed to overwrite the both checkpoint area. */ mach_write_to_8(log_buf + LOG_CHECKPOINT_1 + LOG_CHECKPOINT_LSN, max_lsn); @@ -5459,7 +5448,12 @@ xb_export_cfg_write_table( mach_write_to_4(ptr, col->len); ptr += sizeof(ib_uint32_t); - mach_write_to_4(ptr, col->mbminmaxlen); + /* FIXME: This will not work if mbminlen>4. + This field is also redundant, because the lengths + are a property of the character set encoding, which + in turn is encodedin prtype above. */ + mach_write_to_4(ptr, col->mbmaxlen * 5 + col->mbminlen); + ptr += sizeof(ib_uint32_t); mach_write_to_4(ptr, col->ind); @@ -6165,9 +6159,19 @@ xb_init() return(false); } - if (opt_rsync && xtrabackup_stream_fmt) { - msg("Error: --rsync doesn't work with --stream\n"); - return(false); + if (xtrabackup_backup && opt_rsync) + { + if (xtrabackup_stream_fmt) + { + msg("Error: --rsync doesn't work with --stream\n"); + return(false); + } + bool have_rsync = IF_WIN(false, (system("rsync --version > /dev/null 2>&1") == 0)); + if (!have_rsync) + { + msg("Error: rsync executable not found, cannot run backup with --rsync\n"); + return false; + } } n_mixed_options = 0; diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h index 300474e061ef65399947adbd75e55c453054eef9..4f05b425afd73157ff17f249ad342f112861fda5 100644 --- a/include/ma_dyncol.h +++ b/include/ma_dyncol.h @@ -69,6 +69,9 @@ typedef struct st_mysql_lex_string LEX_STRING; #define DYNCOL_UTF (&my_charset_utf8_general_ci) #endif +/* escape json strings */ +#define DYNCOL_JSON_ESC ((char)1) + enum enum_dyncol_func_result { ER_DYNCOL_OK= 0, diff --git a/include/my_compare.h b/include/my_compare.h index 3440d9ef920c14bf4a5303c328e9477718410e94..1c50ff937913f2cfbaa6994ef8e2ce99513ea1c6 100644 --- a/include/my_compare.h +++ b/include/my_compare.h @@ -91,17 +91,19 @@ typedef struct st_HA_KEYSEG /* Key-portion */ #define size_to_store_key_length(length) ((length) < 255 ? 1 : 3) -#define get_rec_bits(bit_ptr, bit_ofs, bit_len) \ - (((((uint16) (bit_ptr)[1] << 8) | (uint16) (bit_ptr)[0]) >> (bit_ofs)) & \ - ((1 << (bit_len)) - 1)) - -#define set_rec_bits(bits, bit_ptr, bit_ofs, bit_len) \ -{ \ - (bit_ptr)[0]= ((bit_ptr)[0] & ~(((1 << (bit_len)) - 1) << (bit_ofs))) | \ - ((bits) << (bit_ofs)); \ - if ((bit_ofs) + (bit_len) > 8) \ - (bit_ptr)[1]= ((bit_ptr)[1] & ~((1 << ((bit_len) - 8 + (bit_ofs))) - 1)) | \ - ((bits) >> (8 - (bit_ofs))); \ +static inline uint16 get_rec_bits(const uchar *ptr, uchar ofs, uint len) +{ + uint16 val= ptr[0]; + if (ofs + len > 8) + val|= (uint16)(ptr[1]) << 8; + return (val >> ofs) & ((1 << len) - 1); +} + +static inline void set_rec_bits(uint16 bits, uchar *ptr, uchar ofs, uint len) +{ + ptr[0]= (ptr[0] & ~(((1 << len) - 1) << ofs)) | (bits << ofs); + if (ofs + len > 8) + ptr[1]= (ptr[1] & ~((1 << (len - 8 + ofs)) - 1)) | (bits >> (8 - ofs)); } #define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \ diff --git a/include/my_global.h b/include/my_global.h index b9284b99577582f1efd8b59ed1d9a56db490bf13..acc54398cf88ed31fa3379b4766c130b2908413a 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1091,11 +1091,19 @@ static inline char *dlerror(void) #ifndef HAVE_DLERROR #define dlerror() "" #endif +#ifndef HAVE_DLADDR +#define dladdr(A, B) 0 +/* Dummy definition in case we're missing dladdr() */ +typedef struct { const char *dli_fname, dli_fbase; } Dl_info; +#endif #else #define dlerror() "No support for dynamic loading (static build?)" #define dlopen(A,B) 0 #define dlsym(A,B) 0 #define dlclose(A) 0 +#define dladdr(A, B) 0 +/* Dummy definition in case we're missing dladdr() */ +typedef struct { const char *dli_fname, dli_fbase; } Dl_info; #endif /* diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 3fb93350213a2f990da75e6932f20dd456d39155..e3aa11ee355d71bada18f04bf5b3077a2ab8af7e 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -13,6 +13,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ +/* clang -> gcc */ +#ifndef __has_feature +# define __has_feature(x) 0 +#endif +#if __has_feature(address_sanitizer) +# define __SANITIZE_ADDRESS__ 1 +#endif + #ifdef HAVE_valgrind #define IF_VALGRIND(A,B) A #else @@ -25,7 +33,13 @@ # define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len) # define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len) # define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len) -#else /* HAVE_VALGRIND */ +#elif defined(__SANITIZE_ADDRESS__) +# include +# define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len) +# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len) +# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) +# define MEM_CHECK_DEFINED(a,len) ((void) 0) +#else # define MEM_UNDEFINED(a,len) ((void) 0) # define MEM_NOACCESS(a,len) ((void) 0) # define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0) @@ -33,11 +47,9 @@ #endif /* HAVE_VALGRIND */ #ifndef DBUG_OFF -#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); memset(A, C, trash_tmp); MEM_UNDEFINED(A, trash_tmp); } while (0) +#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0) #else -#define TRASH_FILL(A,B,C) do{ const size_t trash_tmp __attribute__((unused)) = (B) ; MEM_CHECK_ADDRESSABLE(A,trash_tmp);MEM_UNDEFINED(A,trash_tmp);} while (0) +#define TRASH_FILL(A,B,C) do { const size_t trash_tmp __attribute__((unused))= (B); MEM_UNDEFINED(A,trash_tmp); } while (0) #endif -#define TRASH_ALLOC(A,B) TRASH_FILL(A,B,0xA5) -#define TRASH_FREE(A,B) TRASH_FILL(A,B,0x8F) -#define TRASH(A,B) TRASH_FREE(A,B) - +#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0) +#define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0) diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h index cd7cd6692be26e5bad343fbce7e33ed21951a61c..1b4b17cfc0d51f5706cd99fede6649472b7a67ea 100644 --- a/include/welcome_copyright_notice.h +++ b/include/welcome_copyright_notice.h @@ -17,7 +17,7 @@ #ifndef _welcome_copyright_notice_h_ #define _welcome_copyright_notice_h_ -#define COPYRIGHT_NOTICE_CURRENT_YEAR "2017" +#define COPYRIGHT_NOTICE_CURRENT_YEAR "2018" /* This define specifies copyright notice which is displayed by every MySQL diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index acbd80b48758f64313a59b0c8a1bb2f7c938bdcd..001bd884865a8e494144adb9e9f27635310b5247 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -500,14 +500,14 @@ IF(NOT DISABLE_SHARED) OUTPUT_NAME mysqlclient VERSION "${OS_SHARED_LIB_VERSION}" SOVERSION "${SHARED_LIB_MAJOR_VERSION}") - IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS) + IF(VERSION_SCRIPT_LINK_FLAGS) GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS) IF(NOT libmysql_link_flags) # Avoid libmysql_link_flags-NOTFOUND SET(libmysql_link_flags) ENDIF() SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS - "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}") + "${libmysql_link_flags} ${VERSION_SCRIPT_LINK_FLAGS}") ENDIF() # clean direct output needs to be set several targets have the same name #(mysqlclient in this case) diff --git a/man/mysqladmin.1 b/man/mysqladmin.1 index d1fdfd9d5aae4ec6605491767a9031ca1ee2802d..cfda6f1c4215e98c8898c344aad76813a820a729 100644 --- a/man/mysqladmin.1 +++ b/man/mysqladmin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQLADMIN\FR" "1" "14/12/2015" "MariaDB 10\&.1" "MariaDB Database System" +.TH "\FBMYSQLADMIN\FR" "1" "28 December 2017" "MariaDB 10\&.1" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -106,6 +106,97 @@ Display the server status variables and their values\&. .sp -1 .IP \(bu 2.3 .\} +flush\-all\-statistics +.sp +Flush all statistics tables\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-all\-status +.sp +Flush all status and statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-binary\-log +.sp +Flush the binary log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-client\-statistics +.sp +Flush client statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-engine\-log +.sp +Flush engine log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-error\-log +.sp +Flush error log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-general\-log +.sp +Flush general query log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-hosts .sp Flush all information in the host cache\&. @@ -119,6 +210,19 @@ Flush all information in the host cache\&. .sp -1 .IP \(bu 2.3 .\} +flush\-index\-statistics +.sp +Flush index statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-logs .sp Flush all logs\&. @@ -146,6 +250,32 @@ reload)\&. .sp -1 .IP \(bu 2.3 .\} +flush\-relay\-log +.sp +Flush relay log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +flush\-slow\-log +.sp +Flush slow query log\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-status .sp Clear status variables\&. @@ -159,6 +289,19 @@ Clear status variables\&. .sp -1 .IP \(bu 2.3 .\} +flush\-table\-statistics +.sp +Flush table statistics\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} flush\-tables .sp Flush all tables\&. @@ -185,6 +328,19 @@ Flush the thread cache\&. .sp -1 .IP \(bu 2.3 .\} +flush\-user\-resources +.sp +Flush user resources\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} kill \fIid\fR,\fIid\fR,\&.\&.\&. .sp Kill server threads\&. If multiple thread ID values are given, there must be no spaces in the list\&. @@ -344,6 +500,19 @@ Stop the server\&. .sp -1 .IP \(bu 2.3 .\} +start\-all\-slaves +.sp +Start all slaves\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} start\-slave .sp Start replication on a slave server\&. @@ -370,6 +539,19 @@ Display a short server status message\&. .sp -1 .IP \(bu 2.3 .\} +stop\-all\-slaves +.sp +Stop all slaves\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} stop\-slave .sp Stop replication on a slave server\&. @@ -821,7 +1003,7 @@ Connect to the MariaDB server on the given host\&. \fB\-\-local\fR, \fB\-l\fR .sp -Suppress the SQL command(s) from being written to the binary log by enabling sql_log_bin=0 for the session\&. +Suppress the SQL command(s) from being written to the binary log by using FLUSH LOCAL or enabling sql_log_bin=0 for the session\&. .RE .sp .RS 4 diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 1c7cfaf81da67a5af5cfc78beee5efd515eb8dd7..c03f0c358386ef449500f4c6af6c83458077e800 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2018, 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 diff --git a/mysql-test/include/truncate_file.inc b/mysql-test/include/truncate_file.inc index 2326d6c0b940cdc032a5724619f35c13889a8b03..fe88cb05bd92fad1ad3d4029c28c323509bf510a 100644 --- a/mysql-test/include/truncate_file.inc +++ b/mysql-test/include/truncate_file.inc @@ -1,16 +1,11 @@ # truncate a giving file, all contents of the file are be cleared -if (!$file) +if (!$TRUNCATE_FILE) { - --echo Please assign a file name to $file!! - exit; + die TRUNCATE_FILE is not set; } -let TRUNCATE_FILE= $file; - perl; -use Env; -Env::import('TRUNCATE_FILE'); -open FILE, '>', $TRUNCATE_FILE || die "Can not open file $file"; +open FILE, '>', $ENV{TRUNCATE_FILE} or die "open(>$ENV{TRUNCATE_FILE}): $!"; close FILE; EOF diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index f3ee772cca3f67eb16dcfa0096f384e6c575b5fc..2980992290c4c878c79e88a5d268a8f6200b68e6 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -84,7 +84,7 @@ sub is_child { } -my @safe_process_cmd; +our @safe_process_cmd; my $safe_kill; my $bindir; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 3b1bb0b5cb026b211cb458a1d93c01a33a503c7f..eaec51b82b45e2408c322a3be8015e27e2a335a4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1589,6 +1589,7 @@ sub command_line_setup { $opt_manual_debug || $opt_dbx || $opt_client_dbx || $opt_manual_dbx || $opt_debugger || $opt_client_debugger ) { + $ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || ''); if ( using_extern() ) { mtr_error("Can't use --extern when using debugger"); @@ -3198,6 +3199,9 @@ sub mysql_install_db { mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql", $bootstrap_sql_file); + # Don't install anonymous users + mtr_tofile($bootstrap_sql_file, "set \@skip_auth_anonymous=1;\n"); + # Add the mysql system tables initial data # for a production system mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql", @@ -3232,10 +3236,6 @@ sub mysql_install_db { sql_to_bootstrap($text)); } - # Remove anonymous users - mtr_tofile($bootstrap_sql_file, - "DELETE FROM mysql.user where user= '';\n"); - # Create mtr database mtr_tofile($bootstrap_sql_file, "CREATE DATABASE mtr CHARSET=latin1;\n"); @@ -5042,7 +5042,7 @@ sub mysqld_start ($$) { my $args; mtr_init_args(\$args); - if ( $opt_valgrind_mysqld ) + if ( $opt_valgrind_mysqld and not $opt_gdb and not $opt_manual_gdb ) { valgrind_arguments($args, \$exe); } @@ -5645,11 +5645,20 @@ sub gdb_arguments { unlink($gdb_init_file); # Put $args into a single string - my $str= join(" ", @$$args); $input = $input ? "< $input" : ""; - # write init file for mysqld or client - mtr_tofile($gdb_init_file, "set args $str $input\n"); + if ($type ne 'client' and $opt_valgrind_mysqld) { + my $v = $$exe; + my $vargs = []; + valgrind_arguments($vargs, \$v); + mtr_tofile($gdb_init_file, < ALL NULL NULL NULL NULL 2 +1 PRIMARY hash_ALL NULL #hash#$hj 3075 func 2 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 v3.d 1 Using index +3 DERIVED t3 ALL NULL NULL NULL NULL 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 2 +SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; +a b c d +DROP VIEW v1, v3; +DROP TABLE t1, t2, t3; +# +# MDEV-14786: Server crashes in Item_cond::transform on 2nd +# execution of SP querying from a view +# +create table t1 (i int, row_start timestamp(6) not null default now(), +row_end timestamp(6) not null default '2030-01-01 0:0:0'); +create view v1 as select i from t1 where i < 5 and (row_end = +TIMESTAMP'2030-01-01 0:0:0' or row_end is null); +create procedure pr(x int) select i from v1; +call pr(1); +i +call pr(2); +i +drop procedure pr; +drop view v1; +drop table t1; # end of 5.5 # # Start of 10.1 tests diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index b0d28a81043fbaf16e8286a7d04d24047519152a..81446da9e14d2c74dbf7e94203c1a497d8dc42ba 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1873,5 +1873,15 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)) {"a":1,"b":1} # +# MDEV-7533: COLUMN_JSON() doesn't escape control characters +# in string values +# +SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json; +json +{"test":"\"\\\u0009\u000A\u001A"} +SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; +json +{"test":"First line\u000ASecond line"} +# # end of 10.0 tests # diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 8bf948e0d72a6c42c4970bcc2d2909d753bf6a18..df484363acc3792fcbe1a94b121af86638ac6338 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -742,6 +742,26 @@ txt1 txt2 nnn2 x2 y2 ööö2 mmm2 ùùù2 DROP TABLE t1; # +# MDEV-14743: Server crashes in Item_func_match::init_search +# +CREATE TABLE t1 (f VARCHAR(8)); +INSERT INTO t1 VALUES ('foo'),('bar'); +SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) ); +'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) ) +1 +SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; +f1 f2 +1 0 +1 0 +explain extended +SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1003 select <'foo'>(('foo',(select `test`.`t1`.`f` from `test`.`t1` where (((convert('foo' using latin1)) = `test`.`t1`.`f`) or isnull(`test`.`t1`.`f`)) having (`test`.`t1`.`f`)))) AS `f1`,(match `test`.`t1`.`f` against ('qux' in boolean mode)) AS `f2` from `test`.`t1` +drop table t1; +# # End of 5.5 tests # CREATE TABLE t1 ( diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result index b87ee7bfc522629657c9954ef0f91b03aa6eeb6a..9ab6f74653eb4bf3913a31c6f817e66aa596abd4 100644 --- a/mysql-test/r/func_concat.result +++ b/mysql-test/r/func_concat.result @@ -262,3 +262,9 @@ c2 abcdefghi-abcdefghi DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch; +# +# MDEV-13790 UNHEX() of a somewhat complicated CONCAT() returns NULL +# +SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1; +c1 +0 diff --git a/mysql-test/r/func_isnull.result b/mysql-test/r/func_isnull.result index 2dbe3d036f994e6fd4538d62d4bf7306c054e9e9..88c5bfd54680ac77402e3bd6b5cb5c1a41318239 100644 --- a/mysql-test/r/func_isnull.result +++ b/mysql-test/r/func_isnull.result @@ -24,3 +24,87 @@ INSERT INTO t1( id ) VALUES ( NULL ); SELECT t1.id FROM t1 WHERE (id is not null and id is null ); id DROP TABLE t1; +# End of 5.1 tests +# +# MDEV-14911: IS NULL for field from mergeable view +# +CREATE TABLE t1 (d1 datetime NOT NULL); +INSERT INTO t1 VALUES +('0000-00-00 00:00:00'), ('0000-00-00 00:00:00'), ('1979-09-03 20:49:36'); +SELECT * FROM t1; +d1 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +1979-09-03 20:49:36 +SELECT * FROM t1 WHERE d1 IS NULL; +d1 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE d1 IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`d1` = 0) +SELECT count(*) FROM t1 WHERE d1 IS NULL; +count(*) +2 +CREATE VIEW v1 AS (SELECT * FROM t1); +SELECT * FROM v1; +d1 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +1979-09-03 20:49:36 +SELECT * FROM v1 WHERE d1 IS NULL; +d1 +0000-00-00 00:00:00 +0000-00-00 00:00:00 +EXPLAIN EXTENDED SELECT * FROM v1 WHERE d1 IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`d1` AS `d1` from `test`.`t1` where (`test`.`t1`.`d1` = 0) +SELECT count(*) FROM v1 WHERE d1 IS NULL; +count(*) +2 +SET @save_optimizer_switch=@@optimizer_switch; +SET SESSION optimizer_switch='derived_merge=off'; +SELECT count(*) FROM ( SELECT * FROM t1 ) AS a1 WHERE d1 IS NULL; +count(*) +2 +SET SESSION optimizer_switch='derived_merge=on'; +SELECT count(*) FROM ( SELECT * FROM t1 ) AS a1 WHERE d1 IS NULL; +count(*) +2 +SET optimizer_switch=@save_optimizer_switch; +CREATE TABLE t2 (d1 datetime NOT NULL); +INSERT INTO t2 VALUES +('1980-09-03 20:49:36'), ('0000-00-00 00:00:00'), ('1979-09-03 20:49:36'); +SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL; +d1 d1 +0000-00-00 00:00:00 0000-00-00 00:00:00 +0000-00-00 00:00:00 0000-00-00 00:00:00 +1980-09-03 20:49:36 NULL +EXPLAIN EXTENDED +SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join `test`.`t1` on((`test`.`t1`.`d1` = `test`.`t2`.`d1`)) where ((`test`.`t1`.`d1` = 0) or isnull(`test`.`t1`.`d1`)) +SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL; +d1 d1 +0000-00-00 00:00:00 0000-00-00 00:00:00 +0000-00-00 00:00:00 0000-00-00 00:00:00 +1980-09-03 20:49:36 NULL +EXPLAIN EXTENDED +SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +Warnings: +Note 1003 select `test`.`t2`.`d1` AS `d1`,`test`.`t1`.`d1` AS `d1` from `test`.`t2` left join (`test`.`t1`) on((`test`.`t1`.`d1` = `test`.`t2`.`d1`)) where ((`test`.`t1`.`d1` = 0) or isnull(`test`.`t1`.`d1`)) +DROP VIEW v1; +DROP TABLE t1,t2; +# +# End of 5.5 tests +# diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result index 7a11cb95715b3b9ba992757d040b7866144f7a66..9eb1654e2ccfd2993ae1a84a32a74496f20cf819 100644 --- a/mysql-test/r/join_cache.result +++ b/mysql-test/r/join_cache.result @@ -5864,6 +5864,64 @@ set join_buffer_size=default; set join_cache_level = default; DROP TABLE t1,t2; # +# MDEV-14960: BNLH used for materialized semi-join +# +CREATE TABLE t1 (i1 int); +CREATE TABLE t2 (e1 int); +CREATE TABLE t4 (e1 int); +CREATE TABLE t5 (e1 int); +INSERT INTO t1 VALUES +(1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 SELECT i1+8 FROM t1; +INSERT INTO t1 SELECT i1+16 FROM t1; +INSERT INTO t1 SELECT i1+32 FROM t1; +INSERT INTO t1 SELECT i1+64 FROM t1; +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t4 SELECT * FROM t1; +INSERT INTO t5 SELECT * FROM t1; +set @save_optimizer_switch= @@optimizer_switch; +SET join_cache_level = 6; +SET join_buffer_size=4096; +SET join_buffer_space_limit=4096; +SET optimizer_switch = 'join_cache_hashed=on,optimize_join_buffer_size=on'; +EXPLAIN SELECT * FROM t1 +WHERE +i1 < 10 AND +i1 IN +(SELECT i1 FROM +(SELECT (t4.e1) i1 FROM t4 +LEFT JOIN t5 ON t4.e1 = t5.e1 +LEFT JOIN (SELECT e1 FROM t2 ) AS d ON t4.e1 = d.e1) a); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 128 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 +2 MATERIALIZED t4 ALL NULL NULL NULL NULL 128 +2 MATERIALIZED t5 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 hash_ALL NULL #hash#$hj 5 test.t4.e1 128 Using where; Using join buffer (incremental, BNLH join) +SELECT * FROM t1 +WHERE +i1 < 10 AND +i1 IN +(SELECT i1 FROM +(SELECT (t4.e1) i1 FROM t4 +LEFT JOIN t5 ON t4.e1 = t5.e1 +LEFT JOIN (SELECT e1 FROM t2 ) AS d ON t4.e1 = d.e1) a); +i1 +1 +2 +3 +4 +5 +6 +7 +8 +9 +SET join_cache_level = default; +SET join_buffer_size = default; +SET join_buffer_space_limit= default; +set optimizer_switch=@save_optimizer_switch; +DROP TABLE t1,t4,t5,t2; +# # MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins. # set join_cache_level=default; diff --git a/mysql-test/r/mdev_14586.result b/mysql-test/r/mdev_14586.result new file mode 100644 index 0000000000000000000000000000000000000000..f6c2095d3cd236894d4ded5d31ff8b2746882769 --- /dev/null +++ b/mysql-test/r/mdev_14586.result @@ -0,0 +1,44 @@ +create table t1(a bit(1), b int auto_increment ,id int, index(a,b)); +insert into t1 values(1,null,1); +insert into t1 values(1,null,2); +insert into t1 values(0,null,3); +insert into t1 values(0,null,4); +select a+0, b as auto_increment , id from t1 order by id; +a+0 auto_increment id +1 1 1 +1 2 2 +0 1 3 +0 2 4 +drop table t1; +create table t1(a int auto_increment, b bit(5) ,id int, index (b,a)); +insert into t1 values(null,b'1',1); +insert into t1 values(null,b'1',2); +insert into t1 values(null,b'11',3); +insert into t1 values(null,b'11',4); +select a as auto_increment, b+0, id from t1 order by id; +auto_increment b+0 id +1 1 1 +2 1 2 +1 3 3 +2 3 4 +drop table t1; +create table t1(a bit(1), b int auto_increment , c bit(1) , d bit(1), id int,index(a,c,b,d)); +insert into t1 values(1,null,1,1,1); +insert into t1 values(1,null,1,1,2); +insert into t1 values(0,null,1,1,3); +insert into t1 values(1,null,0,1,4); +select a+0, b as auto_increment, c+0, d+0, id from t1 order by id; +a+0 auto_increment c+0 d+0 id +1 1 1 1 1 +1 2 1 1 2 +0 1 1 1 3 +1 1 0 1 4 +drop table t1; +CREATE TABLE t1 (b BIT(1), pk INTEGER AUTO_INCREMENT PRIMARY KEY); +ALTER TABLE t1 ADD INDEX(b,pk); +INSERT INTO t1 VALUES (1,b'1'); +ALTER TABLE t1 DROP PRIMARY KEY; +select b+0, pk as auto_increment from t1; +b+0 auto_increment +1 1 +DROP TABLE t1; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index 36e196497e580a9b115bfd5f8da9ce7d4870e4c8..97c391566dd37aaa748ea41ca931f7dafa1fa51f 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2167,7 +2167,7 @@ col1 int(10) NOT NULL ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1); insert into m1 (col1) values (1); insert into m1 (col1) values (1); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Can't write; duplicate key in table 'm1' drop table m1, t1; # # Bug#45800 crash when replacing into a merge table and there is a duplicate @@ -2204,7 +2204,7 @@ CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LA INSERT INTO m1 VALUES (1,2); # insert the duplicate value into the merge table INSERT INTO m1 VALUES (3,2); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Can't write; duplicate key in table 'm1' DROP TABLE m1,t1; # Try to define MERGE and MyISAM with keys on different columns CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1)); diff --git a/mysql-test/r/myisam_optimize.result b/mysql-test/r/myisam_optimize.result index ae0c5b59d060aa04b872eab3b83eaab857e5d935..36faba5eaa9ad4b2fece510b1680e96a3a171a46 100644 --- a/mysql-test/r/myisam_optimize.result +++ b/mysql-test/r/myisam_optimize.result @@ -22,3 +22,17 @@ a left(b,10) 4 CCCCCCCCCC drop table t1; set debug_sync='reset'; +# End of 5.5 tests +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT * FROM INFORMATION_SCHEMA.TABLES; +SELECT * FROM t1; +i +1 +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.0 tests diff --git a/mysql-test/r/mysqldump-nl.result b/mysql-test/r/mysqldump-nl.result index 829bf9801036f1dfaecdad3f70c35b71e983fa4a..d397453b0712687caf3ed526857367e3b1ff7c62 100644 --- a/mysql-test/r/mysqldump-nl.result +++ b/mysql-test/r/mysqldump-nl.result @@ -124,3 +124,46 @@ v1 1v drop database `mysqltest1 1tsetlqsym`; +create database `test```; +create database `test\`` +\! ls +#`; +show databases like 'test%'; +Database (test%) +test +test\` +\! ls +# +test` + +-- +-- Current Database: `test``` +-- + +/*!40000 DROP DATABASE IF EXISTS `test```*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test``` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test```; + +-- +-- Current Database: `test\`` +-- \! ls +-- #` +-- + +/*!40000 DROP DATABASE IF EXISTS `test\`` +\! ls +#`*/; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test\`` +\! ls +#` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `test\`` +\! ls +#`; +drop database `test```; +drop database `test\`` +\! ls +#`; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 71aa32f0cee3dc8237ac3548396eefccf57a0aa7..4cd9aebdf49f16489a84dd1068cf9b0362f27d97 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -2950,6 +2950,52 @@ ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3, 1 1 2 +# +# mdev-6706: semi-join with duplicate weedout + ORDER BY +# +CREATE TABLE t1 (f1 VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'); +CREATE TABLE t2 (f2 VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bar'),('baz'); +CREATE TABLE t3 +(i3_key INT, f3_key VARCHAR(3), f3 VARCHAR(3), KEY(f3_key,i3_key)) +ENGINE=MyISAM; +INSERT INTO t3 VALUES (0,'qux','qux'),(8,'bar','bar'); +SELECT CONCAT( f1, f2 ) AS field FROM t1, t2 +WHERE f1 = ANY ( SELECT f1 +FROM t1 +LEFT JOIN ( t3 AS t3a, t3 AS t3b ) +ON ( t3b.f3_key = t3a.f3 ) +WHERE t3a.f3 < f1 OR t3b.f3 != f1 ); +field +foobar +foobaz +SELECT CONCAT( f1, f2 ) AS field FROM t1, t2 +WHERE f1 = ANY ( SELECT f1 +FROM t1 +LEFT JOIN ( t3 AS t3a, t3 AS t3b ) +ON ( t3b.f3_key = t3a.f3 ) +WHERE t3a.f3 < f1 OR t3b.f3 != f1 ) +ORDER BY field; +field +foobar +foobaz +EXPLAIN EXTENDED SELECT CONCAT( f1, f2 ) AS field FROM t1, t2 +WHERE f1 = ANY ( SELECT f1 +FROM t1 +LEFT JOIN ( t3 AS t3a, t3 AS t3b ) +ON ( t3b.f3_key = t3a.f3 ) +WHERE t3a.f3 < f1 OR t3b.f3 != f1 ) +ORDER BY field; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t3a ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary +1 PRIMARY t3b ref f3_key f3_key 6 test.t3a.f3 1 100.00 Using where; End temporary +Warnings: +Note 1003 select concat('foo',`test`.`t2`.`f2`) AS `field` from `test`.`t2` semi join ((`test`.`t3` `t3a` join `test`.`t3` `t3b`)) where ((`test`.`t3a`.`f3` < 'foo') or (`test`.`t3b`.`f3` <> 'foo')) order by concat('foo',`test`.`t2`.`f2`) +DROP TABLE t1,t2,t3; End of 5.5 tests # # MDEV-5884: EXPLAIN UPDATE ... ORDER BY LIMIT shows wrong #rows diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 49ebd1f597935c5642fd98b8dc08f2b362c7903b..53f89c9cd557b86f438df7e943c2a8cd8d37bab5 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -2634,8 +2634,19 @@ alter table t1 drop partition if exists p5; Warnings: Note 1507 Error in list of partitions to DROP DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE=MyISAM PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (0)); +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (1)); +PREPARE stmt FROM 'ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 VALUES LESS THAN (2))'; +EXECUTE stmt; +Warnings: +Note 1517 Duplicate partition name p2 +EXECUTE stmt; +Warnings: +Note 1517 Duplicate partition name p2 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; # -# Start of 10.1 tests +# End of 10.0 tests # # # MDEV-8283 crash in get_mm_leaf with xor on binary col diff --git a/mysql-test/r/partition_windows.result b/mysql-test/r/partition_windows.result index dabcedcb3f92c05468a7779259068f4c503c62b8..756690925f8340935ff76b3df3542ec98505d90a 100644 --- a/mysql-test/r/partition_windows.result +++ b/mysql-test/r/partition_windows.result @@ -26,9 +26,5 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data Warnings: Warning 1618 option ignored Warning 1618 option ignored -Warning 1618 option ignored -Warning 1618 option ignored -Warning 1618 option ignored -Warning 1618 option ignored INSERT INTO t1 VALUES (NULL, "last", 4); DROP TABLE t1; diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 94f1a51deb7a81190886e1e47050a0dff8f2ced8..26e7bc3736363718aec652e7f6cb3bf74341f59f 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4332,4 +4332,22 @@ set join_cache_level=@join_cache_level_save; deallocate prepare stmt; drop view v1,v2,v3; drop table t1,t2,t3; +# +# MDEV-10657: incorrect result returned with binary protocol +# (prepared statements) +# +create table t1 (code varchar(10) primary key); +INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3'); +SELECT X.* +FROM +(SELECT CODE, RN +FROM +(SELECT A.CODE, @cnt := @cnt + 1 AS RN +FROM t1 A, (SELECT @cnt := 0) C) T +) X; +CODE RN +LINE1 1 +LINE2 2 +LINE3 3 +drop table t1; # End of 5.5 tests diff --git a/mysql-test/r/query_cache_debug.result b/mysql-test/r/query_cache_debug.result index 01c642b325b13650832156ce92fcee4acf80b165..b3070761d9c964f90be1d17ffec7faa3421526ae 100644 --- a/mysql-test/r/query_cache_debug.result +++ b/mysql-test/r/query_cache_debug.result @@ -221,3 +221,29 @@ RESET QUERY CACHE; DROP TABLE t1; SET GLOBAL query_cache_size= DEFAULT; SET GLOBAL query_cache_type= DEFAULT; +# +# MDEV-14526: MariaDB keeps crashing under load when +# query_cache_type is changed +# +CREATE TABLE t1 ( +`id` int(10) NOT NULL AUTO_INCREMENT, +`k` int(10) default '0', +PRIMARY KEY (`id`)) +ENGINE=MyISAM; +INSERT IGNORE INTO t1 VALUES +(NULL,1),(NULL,8),(NULL,NULL),(NULL,NULL),(NULL,4),(NULL,9),(NULL,7), +(NULL,3),(NULL,NULL),(NULL,2),(NULL,3),(NULL,NULL),(NULL,2),(NULL,7), +(NULL,1),(NULL,2),(NULL,4),(NULL,NULL),(NULL,1),(NULL,1),(NULL,4); +SET GLOBAL query_cache_size= 1024*1024; +SET GLOBAL query_cache_type= 1; +set debug_sync="wait_in_query_cache_store_query SIGNAL parked WAIT_FOR go"; +SELECT DISTINCT id FROM t1 WHERE id BETWEEN 5603 AND 16218 ORDER BY k; +set debug_sync="now WAIT_FOR parked"; +SET GLOBAL query_cache_type= 0; +set debug_sync="now SIGNAL go"; +id +set debug_sync= 'RESET'; +DROP TABLE t1; +SEt GLOBAL query_cache_size= DEFAULT; +SEt GLOBAL query_cache_type= DEFAULT; +# End of 5.5 tests diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result index 79ee0c7a9b8ce07f689d3ead41237329875cede8..8d48d2f884826f5daedddf8ece3dd14cddd129ea 100644 --- a/mysql-test/r/repair.result +++ b/mysql-test/r/repair.result @@ -114,7 +114,7 @@ test.t1 repair status OK SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1; -End of 4.1 tests +# End of 4.1 tests # Test with a saved table from 4.1 SHOW TABLE STATUS LIKE 't1'; Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment @@ -150,6 +150,7 @@ SELECT * FROM t1; id 1 DROP TABLE t1; +# End of 5.0 tests DROP TABLE IF EXISTS tt1; CREATE TEMPORARY TABLE tt1 (c1 INT); REPAIR TABLE tt1 USE_FRM; @@ -214,3 +215,17 @@ Table Op Msg_type Msg_text test.v1 repair status OK drop view v1; drop table t1; +# End of 5.5 tests +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT * FROM INFORMATION_SCHEMA.TABLES; +SELECT * FROM t1; +i +1 +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.0 tests diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 9b0ace5c00234ca556b1440375c17d1deb877d97..57d704c36be040958ff9aa222ddcc22091f71780 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -8119,4 +8119,127 @@ SET @aux = f1(); DROP FUNCTION f1; DROP VIEW v1; DROP TABLE t1; +# +# MDEV-14857: problem with 10.2.11 server crashing when +# executing stored procedure +# +SET max_sp_recursion_depth=10; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE PROCEDURE proc_0() +BEGIN +CALL empty_1(); +CALL proc_1(); +END || +CREATE PROCEDURE proc_1() +BEGIN +CALL proc_2(); +CALL proc_3(); +CALL proc_4(); +CALL proc_5(); +END || +CREATE PROCEDURE proc_2() +CALL proc_6(); +|| +CREATE PROCEDURE proc_3() +BEGIN +CALL empty_2(); +CALL empty_3(); +END || +CREATE PROCEDURE proc_4() +CALL proc_7(); +|| +CREATE PROCEDURE proc_5() +CALL proc_select(); +|| +CREATE PROCEDURE proc_6() +BEGIN +CALL empty_4(); +CALL empty_5(); +CALL empty_6(); +CALL empty_7(); +CALL proc_8(); +END || +CREATE PROCEDURE proc_7() +CALL proc_9('foo'); +|| +CREATE PROCEDURE proc_8() +CALL proc_10(); +|| +CREATE PROCEDURE proc_9(IN opt VARCHAR(40)) +IF LEFT(opt,1) <> '_' THEN +CALL proc_11(); +END IF; +|| +CREATE PROCEDURE proc_10() +CALL proc_12(); +|| +CREATE PROCEDURE proc_11() +BEGIN +CALL empty_8(); +CALL empty_9(); +CALL empty_10(); +CALL proc_13(); +END || +CREATE PROCEDURE proc_12() +BEGIN +CALL empty_11(); +CALL empty_12(); +CALL empty_13(); +END || +CREATE PROCEDURE proc_13() +BEGIN +CALL proc_9('_bar'); +CALL empty_14(); +END || +CREATE PROCEDURE empty_1() BEGIN END ; +CREATE PROCEDURE empty_2() BEGIN END ; +CREATE PROCEDURE empty_3() BEGIN END ; +CREATE PROCEDURE empty_4() BEGIN END ; +CREATE PROCEDURE empty_5() BEGIN END ; +CREATE PROCEDURE empty_6() BEGIN END ; +CREATE PROCEDURE empty_7() BEGIN END ; +CREATE PROCEDURE empty_8() BEGIN END ; +CREATE PROCEDURE empty_9() BEGIN END ; +CREATE PROCEDURE empty_10() BEGIN END ; +CREATE PROCEDURE empty_11() BEGIN END ; +CREATE PROCEDURE empty_12() BEGIN END ; +CREATE PROCEDURE empty_13() BEGIN END ; +CREATE PROCEDURE empty_14() BEGIN END ; +CREATE PROCEDURE proc_select() +SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2) +; +CALL proc_0(); +a +DROP PROCEDURE empty_1; +DROP PROCEDURE empty_2; +DROP PROCEDURE empty_3; +DROP PROCEDURE empty_4; +DROP PROCEDURE empty_5; +DROP PROCEDURE empty_6; +DROP PROCEDURE empty_7; +DROP PROCEDURE empty_8; +DROP PROCEDURE empty_9; +DROP PROCEDURE empty_10; +DROP PROCEDURE empty_11; +DROP PROCEDURE empty_12; +DROP PROCEDURE empty_13; +DROP PROCEDURE empty_14; +DROP PROCEDURE proc_0; +DROP PROCEDURE proc_1; +DROP PROCEDURE proc_2; +DROP PROCEDURE proc_3; +DROP PROCEDURE proc_4; +DROP PROCEDURE proc_5; +DROP PROCEDURE proc_6; +DROP PROCEDURE proc_7; +DROP PROCEDURE proc_8; +DROP PROCEDURE proc_9; +DROP PROCEDURE proc_10; +DROP PROCEDURE proc_11; +DROP PROCEDURE proc_12; +DROP PROCEDURE proc_13; +DROP PROCEDURE proc_select; +DROP TABLE t1, t2; +SET max_sp_recursion_depth=default; #End of 10.1 tests diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index cf542a5913e30b311511cc1390802fc2afd75cff..40f936fb3b47f9565018eecaab687684d7cce448 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -7210,6 +7210,32 @@ NULL # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; # drop table t1, t2; +# +# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +# (5.5 test) +# +SET @optimiser_switch_save= @@optimizer_switch; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; +End of 5.5 tests # End of 10.0 tests # # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index a3a6e2ab4c0ac5391b581072bf9ac1c47f7b5b67..a23820820ef768df52e9ae6e60d68b24168affd7 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -7210,6 +7210,32 @@ NULL # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; # drop table t1, t2; +# +# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +# (5.5 test) +# +SET @optimiser_switch_save= @@optimizer_switch; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; +End of 5.5 tests # End of 10.0 tests # # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 11457ccbb026cecef03da646fb686a12ccea2f8a..baa74307f89fc01ef7e5819c676113dfa09e9623 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -7203,6 +7203,32 @@ NULL # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; # drop table t1, t2; +# +# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +# (5.5 test) +# +SET @optimiser_switch_save= @@optimizer_switch; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; +End of 5.5 tests # End of 10.0 tests # # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index 076953c210f48995d0da9ae787932d244cc012f8..039f2fe1a9e06020ac023b74e8d97c7329a3a285 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -7201,6 +7201,32 @@ NULL # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; # drop table t1, t2; +# +# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +# (5.5 test) +# +SET @optimiser_switch_save= @@optimizer_switch; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; +End of 5.5 tests # End of 10.0 tests # # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index b5c7e9bfdbde33d0ff5aa30ae9b2f49ded9dee7c..0ce77bbb37613b210a7743e6c4092c222c991423 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -7216,6 +7216,32 @@ NULL # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; # drop table t1, t2; +# +# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +# (5.5 test) +# +SET @optimiser_switch_save= @@optimizer_switch; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; +End of 5.5 tests # End of 10.0 tests # # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index 52da5f1cec319b243a3d8ed7fecb7064149a4420..574e78122f1439a0e8c5772d14462a5c2cea9d09 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -7201,6 +7201,32 @@ NULL # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; # drop table t1, t2; +# +# MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +# (5.5 test) +# +SET @optimiser_switch_save= @@optimizer_switch; +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); +a +5 +5 +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; +End of 5.5 tests # End of 10.0 tests # # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 233e7399cd2421a84d36e134039fb8579b2c95d6..62b5e2841fb1b17ce4fe73209dd8b3b6aa3d8592 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -2068,6 +2068,43 @@ avg(f) sub 31.5000 0 1.5000 1 drop table t1,t2,t3; +# +# MDEV-14715 Assertion `!table || (!table->read_set || +# bitmap_is_set(table->read_set, field_index))' +# failed in Field_num::val_decimal +# +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1, NULL),(3, 4); +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + sum(a)) +UNION +(SELECT 2, 2); +ERROR HY000: Invalid use of group function +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1) +UNION +(SELECT 2, 2); +a f +1 1 +3 3 +2 2 +SELECT a, b FROM t1 +UNION +(SELECT a, VAR_POP(a) AS f FROM v1 GROUP BY a ORDER BY b/a ); +a b +1 NULL +3 4 +1 0 +3 0 +DROP TABLE t1; +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1) +UNION +(SELECT 2, 2); +ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +DROP VIEW v1; +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1) +UNION +(SELECT 2, 2); +ERROR 42S02: Table 'test.v1' doesn't exist End of 5.5 tests # # WL#1763 Avoid creating temporary table in UNION ALL diff --git a/mysql-test/r/update_innodb.result b/mysql-test/r/update_innodb.result index 5fcc584035af577974f5c608b1d72c4d5a7eafc6..0a85c6dab3e93e6902e928984bfa00a6bbaf98e5 100644 --- a/mysql-test/r/update_innodb.result +++ b/mysql-test/r/update_innodb.result @@ -30,6 +30,16 @@ UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON v drop view v1; drop table t1,t2,t3,t4; # +# MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field +# +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (b INT) ENGINE=InnoDB; +DELETE FROM v1 WHERE a IN ( SELECT a FROM t2 ); +DELETE FROM v1 WHERE (a,a) IN ( SELECT a,a FROM t2 ); +drop view v1; +drop table t1,t2; +# # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt # CREATE TABLE t1 ( diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result index 6c242d950abefd8c66b50e618c3d448d8ddccb06..0bf9b07bb2fdf1ec855eb36adfee11dcfe6b12d3 100644 --- a/mysql-test/r/xa.result +++ b/mysql-test/r/xa.result @@ -200,6 +200,17 @@ a 1 DROP TABLE t1; # +# MDEV-14609 XA Transction unable to ROLLBACK TO SAVEPOINT +# +CREATE TABLE t1 (c1 INT) ENGINE=INNODB; +XA START 'xa1'; +SAVEPOINT savepoint1; +INSERT INTO t1 (c1) VALUES (1),(2),(3),(4); +ROLLBACK TO SAVEPOINT savepoint1; +XA END 'xa1'; +XA ROLLBACK 'xa1'; +DROP TABLE t1; +# # Bug#12352846 - TRANS_XA_START(THD*): # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL() # FAILED diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 41dbc74422825f80de1e5062a68bb695f8c7f676..375b2c6282772d8f4376dbb6d3e9ccb0e6b955b5 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1274,5 +1274,17 @@ c1 c2 2 b2 DROP TABLE t1; # +# MDEV-15118 ExtractValue(xml,something_complex) does not work +# +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CONCAT('aaa')); +SELECT ExtractValue(a, '/a') AS a FROM t1; +a +aaa +SELECT ExtractValue(a, FROM_BASE64(TO_BASE64('/a'))) AS a FROM t1; +a +aaa +DROP TABLE t1; +# # End of 10.0 tests # diff --git a/mysql-test/suite/encryption/t/debug_key_management.test b/mysql-test/suite/encryption/t/debug_key_management.test index 5001ac6a5161074986965305e7e234d05824fd9e..22b213c613573e87c161bb75829b39ff6a884384 100644 --- a/mysql-test/suite/encryption/t/debug_key_management.test +++ b/mysql-test/suite/encryption/t/debug_key_management.test @@ -8,13 +8,14 @@ if (`select count(*) = 0 from information_schema.plugins set global innodb_encrypt_tables=ON; show variables like 'innodb_encrypt%'; -let $wait_condition= select count(*) = 3 from information_schema.innodb_tablespaces_encryption where current_key_version=1; +--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'` +let $wait_condition= select count(*) = $tables_count from information_schema.innodb_tablespaces_encryption where current_key_version=1; --source include/wait_condition.inc select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 1; set global debug_key_management_version=10; -let $wait_condition= select count(*) = 3 from information_schema.innodb_tablespaces_encryption where current_key_version=10; +let $wait_condition= select count(*) = $tables_count from information_schema.innodb_tablespaces_encryption where current_key_version=10; --source include/wait_condition.inc select count(*) from information_schema.innodb_tablespaces_encryption where current_key_version <> 10; diff --git a/mysql-test/suite/encryption/t/encrypt_and_grep.test b/mysql-test/suite/encryption/t/encrypt_and_grep.test index 175c830982cfb07c0d4c6dcd70c4175a50d6e9ae..9395f467539de6eb87d922a02caa2118b2d0cd02 100644 --- a/mysql-test/suite/encryption/t/encrypt_and_grep.test +++ b/mysql-test/suite/encryption/t/encrypt_and_grep.test @@ -63,7 +63,8 @@ SET GLOBAL innodb_encrypt_tables = off; --echo # Wait max 10 min for key encryption threads to decrypt all spaces --let $wait_timeout= 600 ---let $wait_condition=SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0; +--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'` +--let $wait_condition=SELECT COUNT(*) = $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0; --source include/wait_condition.inc SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; diff --git a/mysql-test/suite/encryption/t/innodb_encryption.test b/mysql-test/suite/encryption/t/innodb_encryption.test index 35c2b3695a95871529cde0c422455699192cfc2e..d183a2914bdc70ce5b6b15d69ca4f2e1a5ea51d7 100644 --- a/mysql-test/suite/encryption/t/innodb_encryption.test +++ b/mysql-test/suite/encryption/t/innodb_encryption.test @@ -14,9 +14,11 @@ SHOW VARIABLES LIKE 'innodb_encrypt%'; SET GLOBAL innodb_encrypt_tables = ON; +--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'` + --echo # Wait max 10 min for key encryption threads to encrypt all spaces --let $wait_timeout= 600 ---let $wait_condition=SELECT COUNT(*) >= 3 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; +--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; --source include/wait_condition.inc SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; @@ -59,7 +61,7 @@ SET GLOBAL innodb_encryption_threads=@start_global_value; --echo # Wait max 10 min for key encryption threads to encrypt all spaces --let $wait_timeout= 600 ---let $wait_condition=SELECT COUNT(*) >=3 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; +--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; --source include/wait_condition.inc SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0; diff --git a/mysql-test/suite/federated/net_thd_crash-12951.result b/mysql-test/suite/federated/net_thd_crash-12951.result new file mode 100644 index 0000000000000000000000000000000000000000..573ac96efff59d4885c69307cca5a0ab6cf9b520 --- /dev/null +++ b/mysql-test/suite/federated/net_thd_crash-12951.result @@ -0,0 +1,11 @@ +set global query_cache_size= 16*1024*1024; +set global query_cache_type= 1; +create table t1 (i int) engine=innodb; +create table t2 (i int) engine=federated +CONNECTION="mysql://root@localhost:MASTER_MYPORT/test/t1"; +select * from t2; +i +drop table t2; +drop table t1; +set global query_cache_type= default; +set global query_cache_size= default; diff --git a/mysql-test/suite/federated/net_thd_crash-12951.test b/mysql-test/suite/federated/net_thd_crash-12951.test new file mode 100644 index 0000000000000000000000000000000000000000..81cd826686e6e5a720475bb0fc850ee9ae27a2ff --- /dev/null +++ b/mysql-test/suite/federated/net_thd_crash-12951.test @@ -0,0 +1,23 @@ +# +# MDEV-12951 Server crash [mysqld got exception 0xc0000005] +# + +--source include/have_innodb.inc + +set global query_cache_size= 16*1024*1024; +set global query_cache_type= 1; + +create table t1 (i int) engine=innodb; +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval create table t2 (i int) engine=federated + CONNECTION="mysql://root@localhost:$MASTER_MYPORT/test/t1"; + +select * from t2; + +source include/restart_mysqld.inc; + +drop table t2; +drop table t1; + +set global query_cache_type= default; +set global query_cache_size= default; diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result new file mode 100644 index 0000000000000000000000000000000000000000..40f3f1c0d53fb41902d4d15cb61a9622cdf9eed0 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_gtid_slave.result @@ -0,0 +1,26 @@ +START SLAVE; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); +begin; +insert into t2 values(21); +insert into t2 values(22); +commit; +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4 +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-2 +INSERT INTO t1 VALUES(4); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-2,2-3-3 +DROP TABLE t1,t2; +reset master; +STOP SLAVE; +RESET SLAVE ALL; +reset master; +reset master; diff --git a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result new file mode 100644 index 0000000000000000000000000000000000000000..81fae57d73117acb708b89f4f9349cc1b0a78d5c --- /dev/null +++ b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result @@ -0,0 +1,130 @@ +#Connection 2 +START SLAVE; +#Connection 1 +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB; +INSERT INTO t2 VALUES(1,11); +INSERT INTO t2 VALUES(2,22); +INSERT INTO t2 VALUES(3,33); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4 +include/save_master_gtid.inc +#Connection 2 +include/sync_with_master_gtid.inc +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4 +INSERT INTO t2 VALUES(4,44); +INSERT INTO t2 VALUES(5,55); +INSERT INTO t2 VALUES(6,66); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-3 +#Connection 3 +INSERT INTO t2 VALUES(7,77); +INSERT INTO t2 VALUES(8,88); +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-4,2-2-3,2-3-5 +#Connection 1 +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +COMMIT; +include/save_master_gtid.inc +#Connection 2 +include/sync_with_master_gtid.inc +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +#Connection 3 +Shutting down server ... +#Connection 2 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +COMMIT; +#Connection 3 +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node3_committed_after'); +INSERT INTO t1 VALUES ('node3_committed_after'); +COMMIT; +#Connection 2 +Select * from t1 order by f1; +f1 +node1_committed_before +node1_committed_before +node1_committed_during +node1_committed_during +node2_committed_before +node2_committed_before +node3_committed_after +node3_committed_after +#Connection 3 +Select * from t1 order by f1; +f1 +node1_committed_before +node1_committed_before +node1_committed_during +node1_committed_during +node2_committed_before +node2_committed_before +node3_committed_after +node3_committed_after +#Connection 2 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-6,2-2-7,2-3-8 +#Connection 3 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-6,2-2-7,2-3-8 +#Connection 1 +SET AUTOCOMMIT=ON; +#Connection 2 +SET AUTOCOMMIT=ON; +#Connection 3 +SET AUTOCOMMIT=ON; +#Connection 2 +STOP slave; +INSERT INTO t1 VALUES ('node2_slave_stoped'); +#Connection 1 +INSERT INTO t1 VALUES ('node1_normal_entry'); +include/save_master_gtid.inc +#Connection 2 +INSERT INTO t1 VALUES ('node2_slave_stoped_inserted'); +start slave; +include/sync_with_master_gtid.inc +INSERT INTO t1 VALUES ('node2_slave_started'); +SELECT count(*) from t1; +count(*) +12 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-7,2-3-8,2-2-11 +#Connection 3 +SELECT count(*) from t1; +count(*) +12 +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state +1-1-7,2-3-8,2-2-11 +#Connection 1 +DROP TABLE t2,t1; +#Connection 2 +#Connection 3 +#Connection 2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; +#Connection 3 +reset master; +#Connection 1 +reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.cnf b/mysql-test/suite/galera/t/galera_gtid_slave.cnf new file mode 100644 index 0000000000000000000000000000000000000000..409d0d1609a33873ad2226d2adb5ab0890df6d89 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave.cnf @@ -0,0 +1,18 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +log-bin=mysqld-bin +log-slave-updates +binlog-format=ROW + +[mysqld.1] +gtid-domain-id=1 +[mysqld.2] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 +[mysqld.3] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 + diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.test b/mysql-test/suite/galera/t/galera_gtid_slave.test new file mode 100644 index 0000000000000000000000000000000000000000..8ef87452a5bc023185e2480c140106e14a215821 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave.test @@ -0,0 +1,78 @@ +# +# Test Galera as a slave to a MariaDB master using GTIDs +# +# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes +# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options +# +# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster +# + +--source include/have_innodb.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1); + +#multi stmt trans +begin; +insert into t2 values(21); +insert into t2 values(22); +commit; + +SELECT @@global.gtid_binlog_state; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc +--sleep 1 +INSERT INTO t1 VALUES(2); +INSERT INTO t1 VALUES(3); +SELECT @@global.gtid_binlog_state; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; +--source include/wait_condition.inc + +INSERT INTO t1 VALUES(4); +SELECT @@global.gtid_binlog_state; + +--connection node_1 +DROP TABLE t1,t2; +reset master; +# +# Unfortunately without the sleep below the following statement fails with "query returned no rows", which +# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" +# warning is also reported by MTR, which is also weird. +# + +--sleep 1 + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; + +--connection node_3 +reset master; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf new file mode 100644 index 0000000000000000000000000000000000000000..bb9c8e84f1bf5030de25b9e213c616bbbf3192f1 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf @@ -0,0 +1,18 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +log-bin=mysqld-bin +log-slave-updates +binlog-format=ROW +wsrep_sst_method=rsync +[mysqld.1] +gtid-domain-id=1 +[mysqld.2] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 +[mysqld.3] +gtid-domain-id=2 +wsrep_gtid_mode=1 +wsrep_gtid_domain_id=2 + diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test new file mode 100644 index 0000000000000000000000000000000000000000..3fe94ad16b7cb5f36e12518285e68a574b13126c --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -0,0 +1,207 @@ +# +# Test Galera as a slave to a MariaDB master using GTIDs +# +# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes +# +# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster +# + +--source include/big_test.inc +--source include/have_innodb.inc +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--echo #Connection 2 +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1,master_use_gtid=slave_pos; +--enable_query_log +START SLAVE; +--sleep 1 + + +--echo #Connection 1 +--connection node_1 +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB; +INSERT INTO t2 VALUES(1,11); +INSERT INTO t2 VALUES(2,22); +INSERT INTO t2 VALUES(3,33); + +SELECT @@global.gtid_binlog_state; +--source include/save_master_gtid.inc + +--echo #Connection 2 +--connection node_2 +--source include/sync_with_master_gtid.inc +SELECT @@global.gtid_binlog_state; + +INSERT INTO t2 VALUES(4,44); +INSERT INTO t2 VALUES(5,55); +INSERT INTO t2 VALUES(6,66); +SELECT @@global.gtid_binlog_state; + +--echo #Connection 3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 6 FROM t2; +--source include/wait_condition.inc + +INSERT INTO t2 VALUES(7,77); +INSERT INTO t2 VALUES(8,88); +SELECT @@global.gtid_binlog_state; + +#Perform SST +--echo #Connection 1 +--connection node_1 +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +COMMIT; +--source include/save_master_gtid.inc + +--echo #Connection 2 +--connection node_2 +--source include/sync_with_master_gtid.inc +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; + +--echo #Connection 3 +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1'; +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; +--source include/wait_condition.inc +--let $node_1= node_2 +--let $node_2= node_3 +--source include/auto_increment_offset_save.inc +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + + +--echo #Connection 2 +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +COMMIT; + +--echo #Connection 3 +--connection node_3 +--echo Starting server ... +--source include/start_mysqld.inc +--source include/wait_until_ready.inc +--source include/auto_increment_offset_restore.inc + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node3_committed_after'); +INSERT INTO t1 VALUES ('node3_committed_after'); +COMMIT; + +--echo #Connection 2 +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; +--source include/wait_condition.inc +Select * from t1 order by f1; + +--echo #Connection 3 +--connection node_3 +Select * from t1 order by f1; + +#SST Done +--sleep 1 +--echo #Connection 2 +--connection node_2 +SELECT @@global.gtid_binlog_state; + +--echo #Connection 3 +--connection node_3 +SELECT @@global.gtid_binlog_state; + +--echo #Connection 1 +--connection node_1 +SET AUTOCOMMIT=ON; +#drop table t1; +#CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; + +--echo #Connection 2 +--connection node_2 +SET AUTOCOMMIT=ON; +--echo #Connection 3 +--connection node_3 +SET AUTOCOMMIT=ON; + +# +#stop slave on node 2 +--echo #Connection 2 +--connection node_2 +STOP slave; +--sleep 1 +INSERT INTO t1 VALUES ('node2_slave_stoped'); + +--echo #Connection 1 +--connection node_1 +INSERT INTO t1 VALUES ('node1_normal_entry'); +--source include/save_master_gtid.inc + +#start slave +--echo #Connection 2 +--connection node_2 +INSERT INTO t1 VALUES ('node2_slave_stoped_inserted'); +start slave; +--source include/sync_with_master_gtid.inc +INSERT INTO t1 VALUES ('node2_slave_started'); +SELECT count(*) from t1; +SELECT @@global.gtid_binlog_state; + +--echo #Connection 3 +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 12 FROM t1; +--source include/wait_condition.inc +SELECT count(*) from t1; +SELECT @@global.gtid_binlog_state; + +--echo #Connection 1 +--connection node_1 +DROP TABLE t2,t1; + +# Unfortunately without the sleep below the following statement fails with "query returned no rows", which +# is difficult to understand given that it is an aggregate query. A "query execution was interrupted" +# warning is also reported by MTR, which is also weird. +# + +--sleep 3 + +--echo #Connection 2 +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; +--source include/wait_condition.inc + +--echo #Connection 3 +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--echo #Connection 2 +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; + +--echo #Connection 3 +--connection node_3 +reset master; + +--echo #Connection 1 +--connection node_1 +reset master; diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf new file mode 100644 index 0000000000000000000000000000000000000000..3f39b82f7b78d6406208abafc40d1c21803633b7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -0,0 +1,122 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld] +log-bin +log-slave-updates +binlog-format=row +innodb-autoinc-lock-mode=2 +default-storage-engine=innodb +wsrep_gtid_mode=1 +gtid_ignore_duplicates + +wsrep-on=1 +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep_node_address=127.0.0.1 +# enforce read-committed characteristics across the cluster +# wsrep-causal-reads=ON +# wsrep-sync-wait=15 + +[mysqld.1] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep-cluster-address='gcomm://' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' + +[mysqld.2] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' + +[mysqld.3] +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' + + +[mysqld.4] +wsrep_cluster_name=cluster2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port + +wsrep-cluster-address='gcomm://' +wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' + +[mysqld.5] +wsrep_cluster_name=cluster2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' +wsrep_provider_options='base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port' + +[mysqld.6] +wsrep_cluster_name=cluster2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port +wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port' +wsrep_provider_options='base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S' + +wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port +wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port +wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' + +[ENV] +NODE_MYPORT_1= @mysqld.1.port +NODE_MYSOCK_1= @mysqld.1.socket + +NODE_MYPORT_2= @mysqld.2.port +NODE_MYSOCK_2= @mysqld.2.socket + +NODE_MYPORT_3= @mysqld.3.port +NODE_MYSOCK_3= @mysqld.3.socket + +NODE_MYPORT_4= @mysqld.4.port +NODE_MYSOCK_4= @mysqld.4.socket + +NODE_MYPORT_5= @mysqld.5.port +NODE_MYSOCK_5= @mysqld.5.socket + +NODE_MYPORT_6= @mysqld.6.port +NODE_MYSOCK_6= @mysqld.6.socket + +NODE_GALERAPORT_1= @mysqld.1.#galera_port +NODE_GALERAPORT_2= @mysqld.2.#galera_port +NODE_GALERAPORT_3= @mysqld.3.#galera_port +NODE_GALERAPORT_4= @mysqld.4.#galera_port +NODE_GALERAPORT_5= @mysqld.5.#galera_port +NODE_GALERAPORT_6= @mysqld.6.#galera_port + +NODE_SSTPORT_1= @mysqld.1.#sst_port +NODE_SSTPORT_2= @mysqld.2.#sst_port +NODE_SSTPORT_3= @mysqld.3.#sst_port +NODE_SSTPORT_4= @mysqld.4.#sst_port +NODE_SSTPORT_5= @mysqld.5.#sst_port +NODE_SSTPORT_6= @mysqld.6.#sst_port diff --git a/mysql-test/suite/galera_3nodes/include/have_ipv6.inc b/mysql-test/suite/galera_3nodes/include/have_ipv6.inc new file mode 100644 index 0000000000000000000000000000000000000000..560cad03350f626f67fe1fef59a15324e11a74b3 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/include/have_ipv6.inc @@ -0,0 +1,15 @@ +# Check if ipv6 is available. +# +--disable_query_log +--disable_result_log +connect (checkcon123456789,::1,root,,test); +if($mysql_errno) +{ + skip No IPv6 support; +} +connection default; +disconnect checkcon123456789; +--enable_result_log +--enable_query_log +# end check + diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result new file mode 100644 index 0000000000000000000000000000000000000000..35ca84119e74ca78283e9e286ce332fed9dab835 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -0,0 +1,231 @@ +cluster 1 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 1 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 1 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 2 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 2 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +cluster 2 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 3 +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +cluster 1 node 1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 1 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +select * from t1; +cluster_domain_id node_server_id seq_no +1 11 2 +2 21 1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 1 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +drop table t1; +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +cluster 2 node 1 +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +reset master; +reset master; +reset master; +reset master; +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +start slave; +include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +@@gtid_binlog_state + +select @@gtid_slave_pos; +@@gtid_slave_pos + +cluster 1 node 1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 1 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +select * from t1; +cluster_domain_id node_server_id seq_no +1 11 2 +2 21 1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,2-21-1 +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-11-2,1-12-3,2-21-1 +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +#wait for sync cluster 1 and 2 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 2 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1 +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 2 node 3 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2 +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +#wait for sync cluster 2 and 1 +include/save_master_gtid.inc +include/sync_with_master_gtid.inc +cluster 1 node 1 +select @@gtid_binlog_state; +@@gtid_binlog_state +1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3 +drop table t1; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +cluster 2 node 1 +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +reset master; +reset master; +reset master; +reset master; diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf new file mode 100644 index 0000000000000000000000000000000000000000..dc5535ef34ab2050c8e69d2879d1446a9cae8e92 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf @@ -0,0 +1,28 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test to run +# alone on a freshly started cluster. Otherwise there are adverse interactions with +# following tests such as galera_3nodes.galera_var_dirty_reads2 + +!include ../galera_2x3nodes.cnf +[mysqld.1] +wsrep_gtid_domain_id=1 +server-id=11 + +[mysqld.2] +wsrep_gtid_domain_id=1 +server-id=12 + +[mysqld.3] +wsrep_gtid_domain_id=1 +server-id=13 + +[mysqld.4] +wsrep_gtid_domain_id=2 +server-id=21 + +[mysqld.5] +wsrep_gtid_domain_id=2 +server-id=22 + +[mysqld.6] +wsrep_gtid_domain_id=2 +server-id=23 diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test new file mode 100644 index 0000000000000000000000000000000000000000..c679db1305dee78e5272da49892c4ec9c0d652f0 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -0,0 +1,292 @@ +# +# This test creates 2x 3 nodes galera cluster. +# The whole test case +# A <-> B <-> C {Galera cluster 1} +# | {Circular Async replication} +# D <-> E <-> F {Galera cluster 2} +# We will write on any random node to see if gtid is consitent or not +# Then we will kill node D and set up the replication between A and E +# To see whether fail over works or not. + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +--echo cluster 1 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connection node_2 +--echo cluster 1 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +--echo cluster 1 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 +--connection node_4 +--echo cluster 2 node 1 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 +--connection node_5 +--echo cluster 2 node 2 +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 +--connection node_6 +--echo cluster 2 node 3 +SHOW STATUS LIKE 'wsrep_cluster_size'; +#--disable_parsing +--connection node_1 +--replace_result $NODE_MYPORT_4 NODE_MYPORT_4 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--connection node_4 +--replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--echo cluster 1 node 1 +--connection node_1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 1 +--connection node_4 +select @@gtid_binlog_state; +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +select * from t1; +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 2 +--connection node_2 +select @@gtid_binlog_state; +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 1 node 3 +--connection node_3 +select @@gtid_binlog_state; +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 2 +--connection node_5 +select @@gtid_binlog_state; +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 3 +--connection node_6 +select @@gtid_binlog_state; +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 1 +--connection node_1 +select @@gtid_binlog_state; +drop table t1; +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; +--sleep 2 + +--echo cluster 2 node 1 +--connection node_4 +stop slave; +reset slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; + +--connection node_2 +reset master; +--connection node_3 +reset master; +--connection node_5 +reset master; +--connection node_6 +reset master; +#--enable_parsing +# +# This test creates 2x 3 nodes galera cluster. +# The whole test case +# A <-> B <-> C {Galera cluster 1} +# \ / +# \ / +# / {C->D, F->A , Async normal slave repl} +# / \ +# | \ +# D <-> E <-> F {Galera cluster 2} +# We will write on any random node to see if gtid is consitent or not +# Then we will kill node D and set up the replication between A and E +# To see whether fail over works or not. +--connection node_1 +--replace_result $NODE_MYPORT_6 NODE_MYPORT_6 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--connection node_4 +--replace_result $NODE_MYPORT_3 NODE_MYPORT_3 +--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23); +start slave; +--source include/wait_for_slave_to_start.inc +select @@gtid_binlog_state; +select @@gtid_slave_pos; +#--query_vertical SHOW SLAVE STATUS; + +--echo cluster 1 node 1 +--connection node_1 +create table t1 (cluster_domain_id int ,node_server_id int, seq_no int); +insert into t1 values (1, 11, 2); + +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc +--sleep 2 +--echo cluster 2 node 1 +--connection node_4 +insert into t1 values (2, 21, 1); +select @@gtid_binlog_state; +select * from t1; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 2 +--connection node_2 +select @@gtid_binlog_state; +insert into t1 values (1, 12, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 1 node 3 +--connection node_3 +select @@gtid_binlog_state; +insert into t1 values (1, 13, 4); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 1 and 2 +--connection node_1 +--source include/save_master_gtid.inc +--connection node_4 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 2 +--connection node_5 +select @@gtid_binlog_state; +insert into t1 values (2, 22, 2); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + +--echo cluster 2 node 3 +--connection node_6 +select @@gtid_binlog_state; +insert into t1 values (2, 23, 3); +select @@gtid_binlog_state; + +--echo #wait for sync cluster 2 and 1 +--connection node_4 +--source include/save_master_gtid.inc +--connection node_1 +--source include/sync_with_master_gtid.inc + + +--echo cluster 1 node 1 +--connection node_1 +select @@gtid_binlog_state; +drop table t1; +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; + +--echo cluster 2 node 1 +--connection node_4 +stop slave; +change master to master_use_gtid=no, ignore_server_ids=(); +reset master; +set global GTID_SLAVE_POS=""; + +--connection node_2 +reset master; +--connection node_3 +reset master; +--connection node_5 +reset master; +--connection node_6 +reset master; diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test index a6660bd08d1646c5d963671228939d5214c6dd96..cc3f42c7290f849a8f77ce5c39e8c707d275e058 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test @@ -16,7 +16,7 @@ SELECT COUNT(*) = 10 FROM t1; --exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log --exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log ---source include/kill_galera.inc +--source ../galera/include/kill_galera.inc --sleep 1 --connection node_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index 7c9991e68c445d7b0c6cb1a1cb86c77a4211d86b..88d0cfba4f4753e2f08b37aef312e32a86223d35 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -108,7 +108,7 @@ SET SESSION wsrep_on = OFF; --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc ---source include/kill_galera.inc +--source ../galera/include/kill_galera.inc # # Only node #1 should have safe_to_bootstrap: 1 diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result index d6941770cd3fb601aaac7cc23336956b33a44d5c..efbc5c14e61de142cee72feddeb1a7f07c7da872 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online.result +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -426,6 +426,22 @@ ERROR 42000: Duplicate key name 'c2h' SET DEBUG_SYNC = 'RESET'; SET GLOBAL innodb_monitor_disable = module_ddl; DROP TABLE t1; +# +# MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE +# +CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done'; +ALTER TABLE t1 ADD UNIQUE(c); +SET DEBUG_SYNC = 'now WAIT_FOR t1u_created'; +BEGIN; +INSERT INTO t1 VALUES('bar'),('bar'); +SET DEBUG_SYNC = 'now SIGNAL dup_done'; +ERROR 23000: Duplicate entry 'bar' for key 'c' +SET DEBUG_SYNC = 'RESET'; +CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB; +ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c); +ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t2,t1; SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; SET GLOBAL innodb_monitor_enable = default; SET GLOBAL innodb_monitor_disable = default; diff --git a/mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result b/mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result new file mode 100644 index 0000000000000000000000000000000000000000..dba01945de3062233930a192a695414a7d225ac1 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-lru-force-no-free-page.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool"); +SET @saved_debug = @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,ib_lru_force_no_free_page"; +CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB; +BEGIN; +INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200)); +COMMIT; +SET debug_dbug = @saved_debug; +DROP TABLE t1; +FOUND /InnoDB: Difficult to find free blocks / in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/innodb-replace-debug.result b/mysql-test/suite/innodb/r/innodb-replace-debug.result index 84bc9dc97692d04bcb14ade672b4d3e0731382a1..989fb055cbc32b5fc84447d93a3e887058822324 100644 --- a/mysql-test/suite/innodb/r/innodb-replace-debug.result +++ b/mysql-test/suite/innodb/r/innodb-replace-debug.result @@ -4,10 +4,11 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); -set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +set @old_dbug= @@session.debug_dbug; +set debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); select * from t1; f1 f2 f3 14 25 34 drop table t1; -set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; +set debug_dbug = @old_dbug; diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index d50b9b36a4f03ee7973ca5fa939ff588d0b53761..3255b61d422718d269f8434bf62c6381de70990b 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -1,3 +1,5 @@ +create temporary table t (a char(1) character set filename) engine=innodb; +drop temporary table t; set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; drop table if exists t1,t2,t3,t4; drop database if exists mysqltest; @@ -3144,3 +3146,83 @@ show status like "handler_read_key"; Variable_name Value Handler_read_key 0 drop table t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB; +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(0); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ROLLBACK; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 +START TRANSACTION READ ONLY; +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +INSERT INTO t2 VALUES(1); +COMMIT; +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +COMMIT; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 +1 +3 +DROP TABLE t2; +CREATE TEMPORARY TABLE t2 ( +c1 INT AUTO_INCREMENT PRIMARY KEY, +c2 INT, INDEX idx(c2)) ENGINE=InnoDB; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +ROLLBACK; +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 c2 +START TRANSACTION READ ONLY; +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +COMMIT; +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +INSERT INTO t1 VALUES(0); +ERROR 25006: Cannot execute statement in a READ ONLY transaction. +COMMIT; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` int(11) DEFAULT NULL, + PRIMARY KEY (`c1`), + KEY `idx` (`c2`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 +SELECT * FROM t2; +c1 c2 +4 1 +7 1 +5 2 +8 2 +6 3 +9 3 +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result index 0ef6f65d0ff7dbb474d58c093ad9b0ed6530ac81..b3392c1a3c442d4ace3e76c93b460315fe00484d 100644 --- a/mysql-test/suite/innodb/r/innodb_corrupt_bit.result +++ b/mysql-test/suite/innodb/r/innodb_corrupt_bit.result @@ -1,26 +1,62 @@ +set names utf8; +SET UNIQUE_CHECKS=0; +CREATE TABLE corrupt_bit_test_ā( +a INT AUTO_INCREMENT PRIMARY KEY, +b CHAR(100), +c INT, +z INT, +INDEX idx(b)) +ENGINE=InnoDB; +INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); +CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b); +CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b); +SELECT * FROM corrupt_bit_test_ā; a b c z 1 x 1 1 +INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; +select count(*) from corrupt_bit_test_ā; count(*) 2 +SET @save_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,dict_set_index_corrupted'; +check table corrupt_bit_test_ā; Table Op Msg_type Msg_text test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check error Corrupt +SET debug_dbug = @save_dbug; +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); ERROR HY000: Index "idx" is corrupted +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); ERROR HY000: Index "idx" is corrupted +select c from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted +select z from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted +show warnings; Level Code Message Warning 180 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted Error 1712 Index corrupt_bit_test_ā is corrupted +insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); +select * from corrupt_bit_test_ā use index(primary) where a = 10001; a b c z 10001 a 20001 20001 +begin; +insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002); +delete from corrupt_bit_test_ā where a = 10001; +insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); +rollback; +drop index idxā on corrupt_bit_test_ā; +check table corrupt_bit_test_ā; Table Op Msg_type Msg_text test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check error Corrupt +set names utf8; +select z from corrupt_bit_test_ā; ERROR HY000: Index corrupt_bit_test_ā is corrupted +show create table corrupt_bit_test_ā; Table Create Table corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( `a` int(11) NOT NULL AUTO_INCREMENT, @@ -31,8 +67,12 @@ corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( UNIQUE KEY `idxē` (`z`,`b`), KEY `idx` (`b`) ) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 +drop index idxē on corrupt_bit_test_ā; +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); ERROR HY000: Index "idx" is corrupted +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); ERROR HY000: Index "idx" is corrupted +show create table corrupt_bit_test_ā; Table Create Table corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( `a` int(11) NOT NULL AUTO_INCREMENT, @@ -42,7 +82,12 @@ corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` ( PRIMARY KEY (`a`), KEY `idx` (`b`) ) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1 +drop index idx on corrupt_bit_test_ā; +CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); +CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z); +select z from corrupt_bit_test_ā limit 10; z 20001 1 2 +drop table corrupt_bit_test_ā; diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index 5509d985edcaf40e14a9f11eb3cf16906c745df4..efe1c796cf11472b16048b4c46a073612d2a86d0 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -457,8 +457,6 @@ connection default; reap; --enable_parsing #remove below con1 disconnect if above test case is enabled -connection con1; -disconnect con1; connection default; SHOW CREATE TABLE t1; @@ -474,6 +472,31 @@ SET GLOBAL innodb_monitor_disable = module_ddl; DROP TABLE t1; +--echo # +--echo # MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE +--echo # +CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB; +SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done'; +send ALTER TABLE t1 ADD UNIQUE(c); + +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR t1u_created'; +BEGIN; +INSERT INTO t1 VALUES('bar'),('bar'); +SET DEBUG_SYNC = 'now SIGNAL dup_done'; + +connection default; +--error ER_DUP_ENTRY +reap; + +SET DEBUG_SYNC = 'RESET'; +disconnect con1; +CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB; +--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c); +DROP TABLE t2,t1; + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/innodb-lru-force-no-free-page.test b/mysql-test/suite/innodb/t/innodb-lru-force-no-free-page.test new file mode 100644 index 0000000000000000000000000000000000000000..fe04f4b770509a97051929e424a0ebe40362e6d9 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-lru-force-no-free-page.test @@ -0,0 +1,25 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc + +call mtr.add_suppression("InnoDB: Difficult to find free blocks in the buffer pool"); + +SET @saved_debug = @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,ib_lru_force_no_free_page"; + +CREATE TABLE t1 (j LONGBLOB) ENGINE = InnoDB; +BEGIN; +INSERT INTO t1 VALUES (repeat('abcdefghijklmnopqrstuvwxyz',200)); +COMMIT; + +SET debug_dbug = @saved_debug; + +DROP TABLE t1; + +# +# There should be only one message +# +let SEARCH_RANGE= -50000; +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +--let SEARCH_PATTERN=InnoDB: Difficult to find free blocks +--source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb/t/innodb-master.opt b/mysql-test/suite/innodb/t/innodb-master.opt index 5266978e4f0a7ae26531d87bf8c67fa6b2c0b491..2e71d62206dbda60d2a0fed283d8b138d34bf027 100644 --- a/mysql-test/suite/innodb/t/innodb-master.opt +++ b/mysql-test/suite/innodb/t/innodb-master.opt @@ -2,3 +2,5 @@ --default-storage-engine=MyISAM --innodb-strict-mode=0 --innodb-file-per-table=0 +--loose-innodb-track-changed-pages +--loose-innodb-log-archive diff --git a/mysql-test/suite/innodb/t/innodb-replace-debug.test b/mysql-test/suite/innodb/t/innodb-replace-debug.test index 5cec9e1febfc7823d5c0f0c7ab01c879f8af8eb0..7e710ae154cdf24fdbf79100f5e2f4d8f2dc230c 100644 --- a/mysql-test/suite/innodb/t/innodb-replace-debug.test +++ b/mysql-test/suite/innodb/t/innodb-replace-debug.test @@ -8,8 +8,9 @@ create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2), key k2(f3)) engine=innodb; insert into t1 values (14, 24, 34); -set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout'; +set @old_dbug= @@session.debug_dbug; +set debug_dbug = '+d,row_ins_sec_index_entry_timeout'; replace into t1 values (14, 25, 34); select * from t1; drop table t1; -set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout'; +set debug_dbug = @old_dbug; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 2e7306c8e29a5cf4f1800c578eb7985babee8fe0..087d0c6a7dc6f7b8500ee0dc9bc944ee85e3899f 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -1,18 +1,3 @@ -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### - -- source include/have_innodb.inc -- source include/have_innodb_16k.inc @@ -20,6 +5,10 @@ let $MYSQLD_DATADIR= `select @@datadir`; let collation=utf8_unicode_ci; --source include/have_collation.inc + +create temporary table t (a char(1) character set filename) engine=innodb; +drop temporary table t; + set optimizer_switch = 'mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; # Save the original values of some variables in order to be able to @@ -2530,17 +2519,73 @@ select f1 from t1; show status like "handler_read_key"; drop table t1; -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### +# +# Test handling of writes to TEMPORARY tables for read-only transactions +# +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB; + +# Check that the rollback works +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(0); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +ROLLBACK; + +SELECT * FROM t1; +SELECT * FROM t2; + +START TRANSACTION READ ONLY; +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(1); +COMMIT; + +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(3); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +COMMIT; + +SELECT * FROM t1; +SELECT * FROM t2; + +DROP TABLE t2; + +# This time with some indexes +CREATE TEMPORARY TABLE t2 ( + c1 INT AUTO_INCREMENT PRIMARY KEY, + c2 INT, INDEX idx(c2)) ENGINE=InnoDB; + +SHOW CREATE TABLE t2; + +# Check that the rollback works +START TRANSACTION READ ONLY; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +ROLLBACK; + +SELECT * FROM t1; +SELECT * FROM t2; + +START TRANSACTION READ ONLY; +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +COMMIT; + +SET TRANSACTION READ ONLY; +START TRANSACTION; +INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3); +--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION +INSERT INTO t1 VALUES(0); +COMMIT; + +SHOW CREATE TABLE t2; +SELECT * FROM t1; +SELECT * FROM t2; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test index ee04e8d66fcf77f88359e4bc7c1cc852640258fe..86b604b4a6af3526380cf00894b152a24e45765b 100644 --- a/mysql-test/suite/innodb/t/innodb_corrupt_bit.test +++ b/mysql-test/suite/innodb/t/innodb_corrupt_bit.test @@ -8,7 +8,8 @@ -- source include/have_debug.inc -- disable_query_log -call mtr.add_suppression("Flagged corruption of idx.*in"); +call mtr.add_suppression("Flagged corruption of idx.*in "); +-- enable_query_log set names utf8; @@ -37,9 +38,10 @@ INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā; # This will flag all secondary indexes corrupted -SET SESSION debug_dbug="+d,dict_set_index_corrupted"; +SET @save_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,dict_set_index_corrupted'; check table corrupt_bit_test_ā; -SET SESSION debug_dbug=""; +SET debug_dbug = @save_dbug; # Cannot create new indexes while corrupted indexes exist --error ER_INDEX_CORRUPT diff --git a/mysql-test/suite/innodb/t/table_definition_cache_debug.opt b/mysql-test/suite/innodb/t/table_definition_cache_debug.opt index 6d341857397f5a1e76c019d2f38db8fa26d345c6..c2db7e1df6ecef83825705cc0c0351dfbf9d42a1 100644 --- a/mysql-test/suite/innodb/t/table_definition_cache_debug.opt +++ b/mysql-test/suite/innodb/t/table_definition_cache_debug.opt @@ -1 +1 @@ ---innodb-open-files=20 +--innodb-open-files=30 diff --git a/mysql-test/suite/maria/lock.result b/mysql-test/suite/maria/lock.result index 52e83eb111db45b3b59b733bc1d8a95aa7c48fd0..90250568ef5cbf664608361822fc5dc40446002e 100644 --- a/mysql-test/suite/maria/lock.result +++ b/mysql-test/suite/maria/lock.result @@ -30,3 +30,72 @@ drop table t1; CREATE TABLE t1 (i INT) ENGINE=Aria; LOCK TABLES t1 WRITE, t1 AS t1a WRITE; DROP TABLE t1; +# +# MDEV-8200 aria bug with insert select when select is a aria table +# (wrong result or assertion failure: +# `table->file->stats.records > 0 || error') +# +CREATE TABLE t1 (f1 INT) ENGINE=Aria; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +CREATE TABLE tmp (f3 INT) engine=Aria; +LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE; +INSERT INTO tmp SELECT f1 FROM t1; +INSERT INTO t2 SELECT f3 FROM tmp AS tmp_alias; +select * from t2; +f2 +1 +unlock tables; +DROP TABLE t1,t2,tmp; +# +# Same without transactional +# +CREATE TABLE t1 (f1 INT) transactional=0 ENGINE=Aria; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0 +INSERT INTO t1 VALUES (2); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +CREATE TABLE tmp (f3 INT) transactional=0 engine=Aria; +LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE; +INSERT INTO tmp SELECT f1 FROM t1; +INSERT INTO t2 SELECT f3 FROM tmp AS tmp_alias; +select * from t2; +f2 +2 +unlock tables; +DROP TABLE t1,t2,tmp; +# +# Using spatical keys (disables versioning) +# +CREATE TABLE t1 (f1 INT, c1 geometry NOT NULL, SPATIAL KEY i1 (c1)) transactional=1 ENGINE=Aria; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) DEFAULT NULL, + `c1` geometry NOT NULL, + SPATIAL KEY `i1` (`c1`) +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 +INSERT INTO t1 VALUES (3, +PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, + -18.6055555000 -66.8158332999, + -18.7186111000 -66.8102777000, + -18.7211111000 -66.9269443999, + -18.6086111000 -66.9327777000))')); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +CREATE TABLE tmp (f3 INT, c1 geometry NOT NULL, SPATIAL KEY i1 (c1)) transactional=1 ENGINE=Aria; +LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE; +INSERT INTO tmp SELECT f1,c1 FROM t1; +INSERT INTO t2 (f2) SELECT f3 FROM tmp AS tmp_alias; +select * from t2; +f2 +3 +unlock tables; +DROP TABLE t1,t2,tmp; diff --git a/mysql-test/suite/maria/lock.test b/mysql-test/suite/maria/lock.test index 5b6d17069e7c43622efd93d08a6c1b952d3856fa..57447a18c551a8ea65deccc55ffa1aecf90aa4b9 100644 --- a/mysql-test/suite/maria/lock.test +++ b/mysql-test/suite/maria/lock.test @@ -50,3 +50,58 @@ drop table t1; CREATE TABLE t1 (i INT) ENGINE=Aria; LOCK TABLES t1 WRITE, t1 AS t1a WRITE; DROP TABLE t1; + +--echo # +--echo # MDEV-8200 aria bug with insert select when select is a aria table +--echo # (wrong result or assertion failure: +--echo # `table->file->stats.records > 0 || error') +--echo # + +CREATE TABLE t1 (f1 INT) ENGINE=Aria; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +CREATE TABLE tmp (f3 INT) engine=Aria; +LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE; +INSERT INTO tmp SELECT f1 FROM t1; +INSERT INTO t2 SELECT f3 FROM tmp AS tmp_alias; +select * from t2; +unlock tables; +DROP TABLE t1,t2,tmp; + +--echo # +--echo # Same without transactional +--echo # + +CREATE TABLE t1 (f1 INT) transactional=0 ENGINE=Aria; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (2); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +CREATE TABLE tmp (f3 INT) transactional=0 engine=Aria; +LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE; +INSERT INTO tmp SELECT f1 FROM t1; +INSERT INTO t2 SELECT f3 FROM tmp AS tmp_alias; +select * from t2; +unlock tables; +DROP TABLE t1,t2,tmp; + +--echo # +--echo # Using spatical keys (disables versioning) +--echo # + +CREATE TABLE t1 (f1 INT, c1 geometry NOT NULL, SPATIAL KEY i1 (c1)) transactional=1 ENGINE=Aria; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (3, +PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, + -18.6055555000 -66.8158332999, + -18.7186111000 -66.8102777000, + -18.7211111000 -66.9269443999, + -18.6086111000 -66.9327777000))')); +CREATE TABLE t2 (f2 INT) ENGINE=MyISAM; +CREATE TABLE tmp (f3 INT, c1 geometry NOT NULL, SPATIAL KEY i1 (c1)) transactional=1 ENGINE=Aria; +LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE; +INSERT INTO tmp SELECT f1,c1 FROM t1; +INSERT INTO t2 (f2) SELECT f3 FROM tmp AS tmp_alias; +select * from t2; +unlock tables; +DROP TABLE t1,t2,tmp; diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index ddafea1478c1cf5d13085898249a592773f145c2..8078687dad5f2c203302179f466637468d0ef020 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -2696,6 +2696,17 @@ count(*) 13 drop table t1; # +# MDEV-14690: Assertion `page_link == &fake_link' failed in +# pagecache_write_part +# +CREATE TABLE t1 (a CHAR(8), b CHAR(8), c CHAR(8) NOT NULL DEFAULT '', f FLOAT, KEY(f)) ENGINE=Aria; +INSERT INTO t1 (a) VALUES ('foo'); +DELETE FROM t1 WHERE c < 'bar'; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 (b) VALUES (''); +ALTER TABLE t1 ENABLE KEYS; +DROP TABLE t1; +# # BUG#47444 - --myisam_repair_threads > 1 can result in all index # cardinalities=1 # diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 720e7d2ed5de8774bb7b987a759960b6d482cf96..27e9a45fda758897c9573e46ca1e9df34376f30c 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -1967,6 +1967,21 @@ unlock tables; select count(*) from t1; drop table t1; +--echo # +--echo # MDEV-14690: Assertion `page_link == &fake_link' failed in +--echo # pagecache_write_part +--echo # + +CREATE TABLE t1 (a CHAR(8), b CHAR(8), c CHAR(8) NOT NULL DEFAULT '', f FLOAT, KEY(f)) ENGINE=Aria; +INSERT INTO t1 (a) VALUES ('foo'); +DELETE FROM t1 WHERE c < 'bar'; +ALTER TABLE t1 DISABLE KEYS; +INSERT INTO t1 (b) VALUES (''); +ALTER TABLE t1 ENABLE KEYS; + +# Cleanup +DROP TABLE t1; + --echo # --echo # BUG#47444 - --myisam_repair_threads > 1 can result in all index --echo # cardinalities=1 diff --git a/mysql-test/suite/maria/repair.result b/mysql-test/suite/maria/repair.result new file mode 100644 index 0000000000000000000000000000000000000000..6bb9e1b5b9ebb6f7a2a435fef67ddf9f4933bdb9 --- /dev/null +++ b/mysql-test/suite/maria/repair.result @@ -0,0 +1,24 @@ +CREATE TABLE t1 (i INT) ENGINE=Aria TRANSACTIONAL=1; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT * FROM INFORMATION_SCHEMA.TABLES; +SELECT * FROM t1; +i +1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1 (i INT) ENGINE=Aria TRANSACTIONAL=1; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT * FROM INFORMATION_SCHEMA.TABLES; +SELECT * FROM t1; +i +1 +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/maria/repair.test b/mysql-test/suite/maria/repair.test new file mode 100644 index 0000000000000000000000000000000000000000..2f713950d3eca3dc21cf29119897a6dd000db96d --- /dev/null +++ b/mysql-test/suite/maria/repair.test @@ -0,0 +1,24 @@ +# +# MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S +# +CREATE TABLE t1 (i INT) ENGINE=Aria TRANSACTIONAL=1; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +REPAIR TABLE t1; +--disable_result_log +SELECT * FROM INFORMATION_SCHEMA.TABLES; +--enable_result_log +SELECT * FROM t1; +UNLOCK TABLES; +DROP TABLE t1; + +CREATE TABLE t1 (i INT) ENGINE=Aria TRANSACTIONAL=1; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +OPTIMIZE TABLE t1; +--disable_result_log +SELECT * FROM INFORMATION_SCHEMA.TABLES; +--enable_result_log +SELECT * FROM t1; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/mariabackup/huge_lsn.opt b/mysql-test/suite/mariabackup/huge_lsn.opt new file mode 100644 index 0000000000000000000000000000000000000000..74a6450a1ef4e8b29e3b51790c374d445a8d7254 --- /dev/null +++ b/mysql-test/suite/mariabackup/huge_lsn.opt @@ -0,0 +1,6 @@ +--innodb-encrypt-log=ON +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key +--loose-file-key-management-filename=$MTR_SUITE_DIR/filekeys-data.enc +--loose-file-key-management-encryption-algorithm=aes_cbc diff --git a/mysql-test/suite/mariabackup/huge_lsn.result b/mysql-test/suite/mariabackup/huge_lsn.result new file mode 100644 index 0000000000000000000000000000000000000000..f2202c20968f01e88e252e499a7e815afd14038b --- /dev/null +++ b/mysql-test/suite/mariabackup/huge_lsn.result @@ -0,0 +1,19 @@ +# +# MDEV-13416 mariabackup fails with EFAULT "Bad Address" +# +call mtr.add_suppression("InnoDB: New log files created"); +FOUND /InnoDB: New log files created, LSN=175964\d{8}/ in mysqld.1.err +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); +# xtrabackup backup +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t VALUES(2); +# xtrabackup prepare +# shutdown server +# remove datadir +# xtrabackup move back +# restart server +SELECT * FROM t; +i +1 +DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/huge_lsn.test b/mysql-test/suite/mariabackup/huge_lsn.test new file mode 100644 index 0000000000000000000000000000000000000000..baf577769c051e099fe89711c678137e5130bc78 --- /dev/null +++ b/mysql-test/suite/mariabackup/huge_lsn.test @@ -0,0 +1,54 @@ +--source include/not_embedded.inc +--source include/have_file_key_management.inc + +--echo # +--echo # MDEV-13416 mariabackup fails with EFAULT "Bad Address" +--echo # + +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; +let MYSQLD_DATADIR=`select @@datadir`; +call mtr.add_suppression("InnoDB: New log files created"); + +--source include/shutdown_mysqld.inc + +perl; +my $file= "$ENV{MYSQLD_DATADIR}/ibdata1"; +open(FILE, "+<", $file) or die "Unable to open $file\n"; +binmode FILE; +my $ps= $ENV{INNODB_PAGE_SIZE}; +my $page; +die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; +substr($page,26,8) = pack("NN", 4096, ~1024); +substr($page,0,4)=pack("N",0xdeadbeef); +substr($page,$ps-8,4)=pack("N",0xdeadbeef); +sysseek(FILE, 0, 0) || die "Unable to rewind $file\n"; +syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; +close(FILE) || die "Unable to close $file\n"; +EOF + +--remove_files_wildcard $MYSQLD_DATADIR ib_logfile* + +--source include/start_mysqld.inc +let SEARCH_RANGE= -50000; +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +--let SEARCH_PATTERN= InnoDB: New log files created, LSN=175964\d{8} +--source include/search_pattern_in_file.inc + +CREATE TABLE t(i INT) ENGINE INNODB; +INSERT INTO t VALUES(1); + +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log +SET GLOBAL innodb_flush_log_at_trx_commit=1; +INSERT INTO t VALUES(2); +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; +--source include/restart_and_restore.inc +--enable_result_log +SELECT * FROM t; +DROP TABLE t; +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/missing_ibd.result b/mysql-test/suite/mariabackup/missing_ibd.result new file mode 100644 index 0000000000000000000000000000000000000000..53989be7c1493f350c6bdabe28d694efba1ac5cd --- /dev/null +++ b/mysql-test/suite/mariabackup/missing_ibd.result @@ -0,0 +1,6 @@ +create table t1(c1 int) engine=InnoDB; +INSERT INTO t1 VALUES(1); +# xtrabackup backup +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist in engine +drop table t1; diff --git a/mysql-test/suite/mariabackup/missing_ibd.test b/mysql-test/suite/mariabackup/missing_ibd.test new file mode 100644 index 0000000000000000000000000000000000000000..53ce397fd5e88d34385cae6faa94703c3813437a --- /dev/null +++ b/mysql-test/suite/mariabackup/missing_ibd.test @@ -0,0 +1,27 @@ +--source include/have_innodb.inc + +# +# MDEV-13499: Backing up table that "doesn't exist in engine" cause crash in mariabackup when using encryption +# +create table t1(c1 int) engine=InnoDB; +INSERT INTO t1 VALUES(1); +let MYSQLD_DATADIR=`select @@datadir`; + +--source include/shutdown_mysqld.inc + +--remove_file $MYSQLD_DATADIR/test/t1.ibd + +--source include/start_mysqld.inc + +echo # xtrabackup backup; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log + +rmdir $targetdir; + +--error ER_NO_SUCH_TABLE_IN_ENGINE +select * from t1; +drop table t1; + diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result index 9f2381039d37b4c25d0b4b0d80f3fb1c4125e7a0..41af6af72fcda359516c8ef610b2d94e40b4014e 100644 --- a/mysql-test/suite/parts/r/partition_alter_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter_myisam.result @@ -42,3 +42,16 @@ PARTITION p3 VALUES IN (4,5,6) ); ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition DROP TABLE t1; +create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 +partition by key(c1) ( +partition p01 data directory = 'MYSQL_TMP_DIR' + index directory = 'MYSQL_TMP_DIR', +partition p02 data directory = 'MYSQL_TMP_DIR' + index directory = 'MYSQL_TMP_DIR'); +insert into t1 values (1, 1, repeat('a', 100)); +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +alter online table t1 delay_key_write=0; +alter online table t1 delay_key_write=1; +drop table t1; diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test index a53fa333abd3b1795be8e4d45c440b4de7175973..b2bd0e72e4c7922698d709eb6203ca72772b66de 100644 --- a/mysql-test/suite/parts/t/partition_alter_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -1,3 +1,22 @@ --source include/have_partition.inc --let $engine=MyISAM --source inc/part_alter_values.inc + +# +# MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options +# + +replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR; +eval create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1 + partition by key(c1) ( + partition p01 data directory = '$MYSQL_TMP_DIR' + index directory = '$MYSQL_TMP_DIR', + partition p02 data directory = '$MYSQL_TMP_DIR' + index directory = '$MYSQL_TMP_DIR'); +insert into t1 values (1, 1, repeat('a', 100)); +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1; +alter online table t1 delay_key_write=0; +alter online table t1 delay_key_write=1; +drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test index 981cecb66ad4397a6dad6f10aea363018a81b7d2..1c087c550d0e9220dd5b6c70ccc57ef304e4fcd7 100644 --- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test +++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test @@ -25,7 +25,7 @@ sync_slave_with_master; connection master; # Delete './master-bin.000001' from index file. let $MYSQLD_DATADIR= `SELECT @@DATADIR`; -let $file= $MYSQLD_DATADIR/master-bin.index; +let TRUNCATE_FILE= $MYSQLD_DATADIR/master-bin.index; source include/truncate_file.inc; if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`) diff --git a/mysql-test/suite/sys_vars/r/innodb_print_lock_wait_timeout_info_basic.result b/mysql-test/suite/sys_vars/r/innodb_print_lock_wait_timeout_info_basic.result new file mode 100644 index 0000000000000000000000000000000000000000..cc035e4f8bc6cbb25730257b40c142412c8eb65d --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_print_lock_wait_timeout_info_basic.result @@ -0,0 +1,104 @@ +SET @start_global_value = @@global.innodb_print_lock_wait_timeout_info; +SELECT @start_global_value; +@start_global_value +0 +Valid values are 'ON' and 'OFF' +SELECT @@global.innodb_print_lock_wait_timeout_info in (0, 1); +@@global.innodb_print_lock_wait_timeout_info in (0, 1) +1 +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +0 +SELECT @@session.innodb_print_lock_wait_timeout_info; +ERROR HY000: Variable 'innodb_print_lock_wait_timeout_info' is a GLOBAL variable +SHOW global variables LIKE 'innodb_print_lock_wait_timeout_info'; +Variable_name Value +innodb_print_lock_wait_timeout_info OFF +SHOW session variables LIKE 'innodb_print_lock_wait_timeout_info'; +Variable_name Value +innodb_print_lock_wait_timeout_info OFF +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO OFF +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO OFF +SET global innodb_print_lock_wait_timeout_info='OFF'; +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +0 +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO OFF +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO OFF +SET @@global.innodb_print_lock_wait_timeout_info=1; +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +1 +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ON +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ON +SET global innodb_print_lock_wait_timeout_info=0; +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +0 +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO OFF +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO OFF +SET @@global.innodb_print_lock_wait_timeout_info='ON'; +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +1 +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ON +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ON +SET session innodb_print_lock_wait_timeout_info='OFF'; +ERROR HY000: Variable 'innodb_print_lock_wait_timeout_info' is a GLOBAL variable and should be set with SET GLOBAL +SET @@session.innodb_print_lock_wait_timeout_info='ON'; +ERROR HY000: Variable 'innodb_print_lock_wait_timeout_info' is a GLOBAL variable and should be set with SET GLOBAL +SET global innodb_print_lock_wait_timeout_info=1.1; +ERROR 42000: Incorrect argument type to variable 'innodb_print_lock_wait_timeout_info' +SET global innodb_print_lock_wait_timeout_info=1e1; +ERROR 42000: Incorrect argument type to variable 'innodb_print_lock_wait_timeout_info' +SET global innodb_print_lock_wait_timeout_info=2; +ERROR 42000: Variable 'innodb_print_lock_wait_timeout_info' can't be set to the value of '2' +SET global innodb_print_lock_wait_timeout_info=-3; +ERROR 42000: Variable 'innodb_print_lock_wait_timeout_info' can't be set to the value of '-3' +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +1 +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ON +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +VARIABLE_NAME VARIABLE_VALUE +INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ON +SET global innodb_print_lock_wait_timeout_info='AUTO'; +ERROR 42000: Variable 'innodb_print_lock_wait_timeout_info' can't be set to the value of 'AUTO' +SET @@global.innodb_print_lock_wait_timeout_info = @start_global_value; +SELECT @@global.innodb_print_lock_wait_timeout_info; +@@global.innodb_print_lock_wait_timeout_info +0 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index 5c7e310ce080185059d02fc74dc05d4d0d305496..a57fc12948c68892e71aeb4616e1627aaee7834d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -829,10 +829,24 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1727,13 +2035,69 @@ +@@ -1727,13 +2035,83 @@ ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL ++VARIABLE_NAME INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ++SESSION_VALUE NULL ++GLOBAL_VALUE OFF ++GLOBAL_VALUE_ORIGIN COMPILE-TIME ++DEFAULT_VALUE OFF ++VARIABLE_SCOPE GLOBAL ++VARIABLE_TYPE BOOLEAN ++VARIABLE_COMMENT Print lock wait timeout info to MySQL error log (off by default) ++NUMERIC_MIN_VALUE NULL ++NUMERIC_MAX_VALUE NULL ++NUMERIC_BLOCK_SIZE NULL ++ENUM_VALUE_LIST OFF,ON ++READ_ONLY NO ++COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_CLEANER +SESSION_VALUE NULL +GLOBAL_VALUE OFF @@ -1222,7 +1236,7 @@ VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.37 -+GLOBAL_VALUE 5.6.36-82.2 ++GLOBAL_VALUE 5.6.36-83.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index 6aa4e32e95e1f24c1e5b064e26a93afda0030db9..0a2757c5138675b139c257bce55b4299dbfd268d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -415,10 +415,24 @@ VARIABLE_NAME INNODB_MAX_DIRTY_PAGES_PCT SESSION_VALUE NULL GLOBAL_VALUE 75.000000 -@@ -1727,6 +2035,62 @@ +@@ -1727,6 +2035,76 @@ ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL ++VARIABLE_NAME INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO ++SESSION_VALUE NULL ++GLOBAL_VALUE OFF ++GLOBAL_VALUE_ORIGIN COMPILE-TIME ++DEFAULT_VALUE OFF ++VARIABLE_SCOPE GLOBAL ++VARIABLE_TYPE BOOLEAN ++VARIABLE_COMMENT Print lock wait timeout info to MySQL error log (off by default) ++NUMERIC_MIN_VALUE NULL ++NUMERIC_MAX_VALUE NULL ++NUMERIC_BLOCK_SIZE NULL ++ENUM_VALUE_LIST OFF,ON ++READ_ONLY NO ++COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_CLEANER +SESSION_VALUE NULL +GLOBAL_VALUE OFF @@ -478,7 +492,7 @@ VARIABLE_NAME INNODB_PURGE_BATCH_SIZE SESSION_VALUE NULL GLOBAL_VALUE 300 -@@ -1895,6 +2259,48 @@ +@@ -1895,6 +2273,48 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL @@ -527,7 +541,7 @@ VARIABLE_NAME INNODB_SCRUB_LOG SESSION_VALUE NULL GLOBAL_VALUE OFF -@@ -1923,6 +2329,34 @@ +@@ -1923,6 +2343,34 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL @@ -562,7 +576,7 @@ VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES SESSION_VALUE NULL GLOBAL_VALUE 0 -@@ -2000,7 +2434,7 @@ +@@ -2000,7 +2448,7 @@ DEFAULT_VALUE nulls_equal VARIABLE_SCOPE GLOBAL VARIABLE_TYPE ENUM @@ -571,7 +585,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -@@ -2245,6 +2679,34 @@ +@@ -2245,6 +2693,34 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL @@ -606,7 +620,7 @@ VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG SESSION_VALUE NULL GLOBAL_VALUE OFF -@@ -2322,7 +2784,7 @@ +@@ -2322,7 +2798,7 @@ DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN @@ -615,7 +629,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -@@ -2343,6 +2805,20 @@ +@@ -2343,6 +2819,20 @@ ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE @@ -636,7 +650,7 @@ VARIABLE_NAME INNODB_USE_MTFLUSH SESSION_VALUE NULL GLOBAL_VALUE OFF -@@ -2357,6 +2833,20 @@ +@@ -2357,6 +2847,20 @@ ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE @@ -657,12 +671,12 @@ VARIABLE_NAME INNODB_USE_SYS_MALLOC SESSION_VALUE NULL GLOBAL_VALUE ON -@@ -2387,12 +2877,12 @@ +@@ -2387,12 +2891,12 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.37 -+GLOBAL_VALUE 5.6.36-82.2 ++GLOBAL_VALUE 5.6.36-83.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/t/innodb_print_lock_wait_timeout_info_basic.test b/mysql-test/suite/sys_vars/t/innodb_print_lock_wait_timeout_info_basic.test new file mode 100644 index 0000000000000000000000000000000000000000..23d8ba667ced6f2aa1beba712ea79b9fe8c2d010 --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_print_lock_wait_timeout_info_basic.test @@ -0,0 +1,89 @@ +--source include/have_xtradb.inc + +SET @start_global_value = @@global.innodb_print_lock_wait_timeout_info; +SELECT @start_global_value; + +# +# exists as global only +# +--echo Valid values are 'ON' and 'OFF' +SELECT @@global.innodb_print_lock_wait_timeout_info in (0, 1); +SELECT @@global.innodb_print_lock_wait_timeout_info; +--error ER_INCORRECT_GLOBAL_LOCAL_VAR +SELECT @@session.innodb_print_lock_wait_timeout_info; +SHOW global variables LIKE 'innodb_print_lock_wait_timeout_info'; +SHOW session variables LIKE 'innodb_print_lock_wait_timeout_info'; +--disable_warnings +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +--enable_warnings + +# +# SHOW that it's writable +# +SET global innodb_print_lock_wait_timeout_info='OFF'; +SELECT @@global.innodb_print_lock_wait_timeout_info; +--disable_warnings +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +--enable_warnings +SET @@global.innodb_print_lock_wait_timeout_info=1; +SELECT @@global.innodb_print_lock_wait_timeout_info; +--disable_warnings +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +--enable_warnings +SET global innodb_print_lock_wait_timeout_info=0; +SELECT @@global.innodb_print_lock_wait_timeout_info; +--disable_warnings +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +--enable_warnings +SET @@global.innodb_print_lock_wait_timeout_info='ON'; +SELECT @@global.innodb_print_lock_wait_timeout_info; +--disable_warnings +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +--enable_warnings +--error ER_GLOBAL_VARIABLE +SET session innodb_print_lock_wait_timeout_info='OFF'; +--error ER_GLOBAL_VARIABLE +SET @@session.innodb_print_lock_wait_timeout_info='ON'; + +# +# incorrect types +# +--error ER_WRONG_TYPE_FOR_VAR +SET global innodb_print_lock_wait_timeout_info=1.1; +--error ER_WRONG_TYPE_FOR_VAR +SET global innodb_print_lock_wait_timeout_info=1e1; +--error ER_WRONG_VALUE_FOR_VAR +SET global innodb_print_lock_wait_timeout_info=2; +--error ER_WRONG_VALUE_FOR_VAR +SET global innodb_print_lock_wait_timeout_info=-3; +SELECT @@global.innodb_print_lock_wait_timeout_info; +--disable_warnings +SELECT * FROM information_schema.global_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +SELECT * FROM information_schema.session_variables +WHERE variable_name='innodb_print_lock_wait_timeout_info'; +--enable_warnings +--error ER_WRONG_VALUE_FOR_VAR +SET global innodb_print_lock_wait_timeout_info='AUTO'; + +# +# Cleanup +# + +SET @@global.innodb_print_lock_wait_timeout_info = @start_global_value; +SELECT @@global.innodb_print_lock_wait_timeout_info; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 7306a819ad7e16a46fcf59885a31776c9fa68c6f..c6a91a18965ada6fe81f61f6a478edd8e1daf71f 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1765,6 +1765,149 @@ create table t1(ID decimal(2,1) unsigned NOT NULL, PRIMARY KEY (ID))engine=memor select 2.1 ID; drop table t1; +# +# many keys with long names and comments +# +--error ER_CANT_CREATE_TABLE +create table t1 ( + f01 int, f02 int, f03 int, f04 int, f05 int, f06 int, f07 int, f08 int, f09 int, f10 int, f11 int, f12 int, f13 int, f14 int, f15 int, f16 int, f17 int, f18 int, f19 int, f20 int, f21 int, f22 int, f23 int, f24 int, f25 int, f26 int, f27 int, f28 int, f29 int, f30 int, f31 int, f32 int, f33 int, f34 int, f35 int, f36 int, f37 int, f38 int, f39 int, f40 int, f41 int, f42 int, f43 int, f44 int, f45 int, f46 int, f47 int, f48 int, f49 int, f50 int, f51 int, f52 int, f53 int, f54 int, f55 int, f56 int, f57 int, f58 int, f59 int, f60 int, f61 int, f62 int, f63 int, f64 int, + key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0001 (f01) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy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yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', + fend int); + +create table t1 ( + f01 int, f02 int, f03 int, f04 int, f05 int, f06 int, f07 int, f08 int, f09 int, f10 int, f11 int, f12 int, f13 int, f14 int, f15 int, f16 int, f17 int, f18 int, f19 int, f20 int, f21 int, f22 int, f23 int, f24 int, f25 int, f26 int, f27 int, f28 int, f29 int, f30 int, f31 int, f32 int, f33 int, f34 int, f35 int, f36 int, f37 int, f38 int, f39 int, f40 int, f41 int, f42 int, f43 int, f44 int, f45 int, f46 int, f47 int, f48 int, f49 int, f50 int, f51 int, f52 int, f53 int, f54 int, f55 int, f56 int, f57 int, f58 int, f59 int, f60 int, f61 int, f62 int, f63 int, f64 int, + key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0001 (f01) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy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table t1; + --echo End of 5.5 tests # diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index d881430a060f6187f67b16fb725a05a5642f01c3..b0415cf3b04d68ee79cd874c6a44833a9fd33485 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -897,6 +897,44 @@ select distinct t1.id, tt.id, tt.data drop table t1; +--echo # +--echo # MDEV-14241: Server crash in key_copy / get_matching_chain_by_join_key +--echo # or valgrind warnings +--echo # + +CREATE TABLE t1 (a VARCHAR(10)) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); + +CREATE TABLE t2 (b integer auto_increment primary key) ENGINE=MyISAM; +INSERT INTO t2 VALUES (NULL),(NULL); + +CREATE TABLE t3 (c VARCHAR(1024) CHARACTER SET utf8, d INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; +INSERT INTO t3 VALUES ('abc',NULL),('def',4); + +SET join_cache_level= 8; +explain +SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; +SELECT * FROM v1, t2, v3 WHERE a = c AND b = d; + +DROP VIEW v1, v3; +DROP TABLE t1, t2, t3; + +--echo # +--echo # MDEV-14786: Server crashes in Item_cond::transform on 2nd +--echo # execution of SP querying from a view +--echo # +create table t1 (i int, row_start timestamp(6) not null default now(), + row_end timestamp(6) not null default '2030-01-01 0:0:0'); +create view v1 as select i from t1 where i < 5 and (row_end = +TIMESTAMP'2030-01-01 0:0:0' or row_end is null); +create procedure pr(x int) select i from v1; +call pr(1); +call pr(2); +drop procedure pr; +drop view v1; +drop table t1; --echo # end of 5.5 diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test index 03e2345ba1c0f305967518c212c0b361bceb2032..2c93f75cb5ad3cbdeed077722c026b8952065a26 100644 --- a/mysql-test/t/dyncol.test +++ b/mysql-test/t/dyncol.test @@ -920,6 +920,14 @@ SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL)); SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL)); + +--echo # +--echo # MDEV-7533: COLUMN_JSON() doesn't escape control characters +--echo # in string values +--echo # +SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json; +SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json; + --echo # --echo # end of 10.0 tests --echo # diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 9dfc49d3dfde24fd11d557bf4e98758fab27e303..fc7b15c052d01fb3f5f22edfaadfd050d99b85cf 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -682,6 +682,21 @@ SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ööö1' IN BOOLEAN MODE); SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ùùù2' IN BOOLEAN MODE); DROP TABLE t1; + +--echo # +--echo # MDEV-14743: Server crashes in Item_func_match::init_search +--echo # + +CREATE TABLE t1 (f VARCHAR(8)); +INSERT INTO t1 VALUES ('foo'),('bar'); + +SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) ); +SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; +explain extended +SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ; + +drop table t1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index be573f494a28178be195c9577f1197fd08904f6f..69dd2c4063e5381cf853ad96ff1828c8d9226dff 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -236,3 +236,9 @@ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT TRIM(t) t2 FROM t1) sub; DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch; + +--echo # +--echo # MDEV-13790 UNHEX() of a somewhat complicated CONCAT() returns NULL +--echo # + +SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1; diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test index 326574e05152b177a38acc588b189338bb72964f..4c59fa3cbe8c729977b26c2ef94d2671843c8c21 100644 --- a/mysql-test/t/func_isnull.test +++ b/mysql-test/t/func_isnull.test @@ -38,5 +38,51 @@ INSERT INTO t1( id ) VALUES ( NULL ); SELECT t1.id FROM t1 WHERE (id is not null and id is null ); DROP TABLE t1; -# End of 5.1 tests +--echo # End of 5.1 tests +--echo # +--echo # MDEV-14911: IS NULL for field from mergeable view +--echo # + +CREATE TABLE t1 (d1 datetime NOT NULL); +INSERT INTO t1 VALUES + ('0000-00-00 00:00:00'), ('0000-00-00 00:00:00'), ('1979-09-03 20:49:36'); + +SELECT * FROM t1; +SELECT * FROM t1 WHERE d1 IS NULL; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE d1 IS NULL; +SELECT count(*) FROM t1 WHERE d1 IS NULL; + +CREATE VIEW v1 AS (SELECT * FROM t1); +SELECT * FROM v1; +SELECT * FROM v1 WHERE d1 IS NULL; +EXPLAIN EXTENDED SELECT * FROM v1 WHERE d1 IS NULL; +SELECT count(*) FROM v1 WHERE d1 IS NULL; + +SET @save_optimizer_switch=@@optimizer_switch; + +SET SESSION optimizer_switch='derived_merge=off'; +SELECT count(*) FROM ( SELECT * FROM t1 ) AS a1 WHERE d1 IS NULL; +SET SESSION optimizer_switch='derived_merge=on'; +SELECT count(*) FROM ( SELECT * FROM t1 ) AS a1 WHERE d1 IS NULL; + +SET optimizer_switch=@save_optimizer_switch; + +CREATE TABLE t2 (d1 datetime NOT NULL); +INSERT INTO t2 VALUES + ('1980-09-03 20:49:36'), ('0000-00-00 00:00:00'), ('1979-09-03 20:49:36'); + +SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL; +EXPLAIN EXTENDED +SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL; + +SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL; +EXPLAIN EXTENDED +SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL; + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # End of 5.5 tests +--echo # diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test index 5ee868b4177834d014d12596fafefdbd955bf689..ee3e324cd8028fa62a7c2815f81159c3368b071b 100644 --- a/mysql-test/t/join_cache.test +++ b/mysql-test/t/join_cache.test @@ -3824,6 +3824,51 @@ set join_cache_level = default; DROP TABLE t1,t2; +--echo # +--echo # MDEV-14960: BNLH used for materialized semi-join +--echo # + +CREATE TABLE t1 (i1 int); +CREATE TABLE t2 (e1 int); +CREATE TABLE t4 (e1 int); +CREATE TABLE t5 (e1 int); + +INSERT INTO t1 VALUES + (1),(2),(3),(4),(5),(6),(7),(8); +INSERT INTO t1 SELECT i1+8 FROM t1; +INSERT INTO t1 SELECT i1+16 FROM t1; +INSERT INTO t1 SELECT i1+32 FROM t1; +INSERT INTO t1 SELECT i1+64 FROM t1; +INSERT INTO t2 SELECT * FROM t1; +INSERT INTO t4 SELECT * FROM t1; +INSERT INTO t5 SELECT * FROM t1; + +set @save_optimizer_switch= @@optimizer_switch; +SET join_cache_level = 6; +SET join_buffer_size=4096; +SET join_buffer_space_limit=4096; +SET optimizer_switch = 'join_cache_hashed=on,optimize_join_buffer_size=on'; + +let $q= +SELECT * FROM t1 +WHERE + i1 < 10 AND + i1 IN + (SELECT i1 FROM + (SELECT (t4.e1) i1 FROM t4 + LEFT JOIN t5 ON t4.e1 = t5.e1 + LEFT JOIN (SELECT e1 FROM t2 ) AS d ON t4.e1 = d.e1) a); + +eval EXPLAIN $q; +eval $q; + +SET join_cache_level = default; +SET join_buffer_size = default; +SET join_buffer_space_limit= default; +set optimizer_switch=@save_optimizer_switch; + +DROP TABLE t1,t4,t5,t2; + --echo # --echo # MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins. --echo # diff --git a/mysql-test/t/mdev_14586.test b/mysql-test/t/mdev_14586.test new file mode 100644 index 0000000000000000000000000000000000000000..8b3d37801518dcc1c5ac2e5e91ac41b15d0c42c3 --- /dev/null +++ b/mysql-test/t/mdev_14586.test @@ -0,0 +1,27 @@ +create table t1(a bit(1), b int auto_increment ,id int, index(a,b)); +insert into t1 values(1,null,1); +insert into t1 values(1,null,2); +insert into t1 values(0,null,3); +insert into t1 values(0,null,4); +select a+0, b as auto_increment , id from t1 order by id; +drop table t1; +create table t1(a int auto_increment, b bit(5) ,id int, index (b,a)); +insert into t1 values(null,b'1',1); +insert into t1 values(null,b'1',2); +insert into t1 values(null,b'11',3); +insert into t1 values(null,b'11',4); +select a as auto_increment, b+0, id from t1 order by id; +drop table t1; +create table t1(a bit(1), b int auto_increment , c bit(1) , d bit(1), id int,index(a,c,b,d)); +insert into t1 values(1,null,1,1,1); +insert into t1 values(1,null,1,1,2); +insert into t1 values(0,null,1,1,3); +insert into t1 values(1,null,0,1,4); +select a+0, b as auto_increment, c+0, d+0, id from t1 order by id; +drop table t1; +CREATE TABLE t1 (b BIT(1), pk INTEGER AUTO_INCREMENT PRIMARY KEY); +ALTER TABLE t1 ADD INDEX(b,pk); +INSERT INTO t1 VALUES (1,b'1'); +ALTER TABLE t1 DROP PRIMARY KEY; +select b+0, pk as auto_increment from t1; +DROP TABLE t1; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index e9d69b446d568e929fd54613fd26409242e26e26..d2f4ce0e44a01dd6be8c3025e0eeedda09fd16da 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1559,7 +1559,7 @@ CREATE TABLE m1 ( ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1); insert into m1 (col1) values (1); ---error ER_DUP_ENTRY +--error ER_DUP_KEY insert into m1 (col1) values (1); drop table m1, t1; @@ -1593,7 +1593,7 @@ CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2)); CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1); INSERT INTO m1 VALUES (1,2); --echo # insert the duplicate value into the merge table ---error ER_DUP_ENTRY +--error ER_DUP_KEY INSERT INTO m1 VALUES (3,2); DROP TABLE m1,t1; diff --git a/mysql-test/t/myisam_optimize.test b/mysql-test/t/myisam_optimize.test index 5f0b8fc766674c44d764d4ff488e017e842eae6b..5e133aea853291a34c5427785465d9c7736b66d2 100644 --- a/mysql-test/t/myisam_optimize.test +++ b/mysql-test/t/myisam_optimize.test @@ -46,3 +46,20 @@ connection default; drop table t1; set debug_sync='reset'; +--echo # End of 5.5 tests + +# +# MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +OPTIMIZE TABLE t1; +--disable_result_log +SELECT * FROM INFORMATION_SCHEMA.TABLES; +--enable_result_log +SELECT * FROM t1; +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of 10.0 tests diff --git a/mysql-test/t/mysqldump-nl.test b/mysql-test/t/mysqldump-nl.test index 311996e77c3059cc354fd6edbbeae6957ebe37cb..4513fb2c6374711fd1d407171b20c1bffd240c9f 100644 --- a/mysql-test/t/mysqldump-nl.test +++ b/mysql-test/t/mysqldump-nl.test @@ -36,3 +36,23 @@ show tables from `mysqltest1 drop database `mysqltest1 1tsetlqsym`; + +create database `test```; +create database `test\`` +\! ls +#`; + +show databases like 'test%'; + +exec $MYSQL_DUMP --compact --comment --add-drop-database --databases 'test`' 'test\` +\! ls +#'; + +exec $MYSQL_DUMP --compact --comment --add-drop-database --databases 'test`' 'test\` +\! ls +#' | $MYSQL; + +drop database `test```; +drop database `test\`` +\! ls +#`; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index f61a6a8be34ee64d0bb42feabb0c5d8267068d88..1ca258d1d48770029883596b64b68efa743e615f 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -1955,6 +1955,44 @@ UNION ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3, @a5 := 3, @a6 := 3, @a7 := 3, @a8 := 3, @a9 := 3, @a10 := 3 ); + +--echo # +--echo # mdev-6706: semi-join with duplicate weedout + ORDER BY +--echo # + +CREATE TABLE t1 (f1 VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'); + +CREATE TABLE t2 (f2 VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bar'),('baz'); + +CREATE TABLE t3 +(i3_key INT, f3_key VARCHAR(3), f3 VARCHAR(3), KEY(f3_key,i3_key)) + ENGINE=MyISAM; +INSERT INTO t3 VALUES (0,'qux','qux'),(8,'bar','bar'); + +let $q1= +SELECT CONCAT( f1, f2 ) AS field FROM t1, t2 +WHERE f1 = ANY ( SELECT f1 + FROM t1 + LEFT JOIN ( t3 AS t3a, t3 AS t3b ) + ON ( t3b.f3_key = t3a.f3 ) + WHERE t3a.f3 < f1 OR t3b.f3 != f1 ); +let $q2= +SELECT CONCAT( f1, f2 ) AS field FROM t1, t2 +WHERE f1 = ANY ( SELECT f1 + FROM t1 + LEFT JOIN ( t3 AS t3a, t3 AS t3b ) + ON ( t3b.f3_key = t3a.f3 ) + WHERE t3a.f3 < f1 OR t3b.f3 != f1 ) +ORDER BY field; + +eval $q1; +eval $q2; +eval EXPLAIN EXTENDED $q2; + +DROP TABLE t1,t2,t3; + --echo End of 5.5 tests --echo # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index d3161c9338ce5ddc09137c62b49ac954202e9533..35dfdead9160773058bfb837f364004a1570e836 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2884,8 +2884,21 @@ alter table t1 drop partition if exists p5; DROP TABLE t1; +# +# MDEV-14696 Server crashes in in prep_alter_part_table on 2nd execution of PS. +# + +CREATE TABLE t1 (a INT) ENGINE=MyISAM PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (0)); +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (1)); +PREPARE stmt FROM 'ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 VALUES LESS THAN (2))'; +EXECUTE stmt; +EXECUTE stmt; + +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo # ---echo # Start of 10.1 tests +--echo # End of 10.0 tests --echo # --echo # diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 6eed931276c404ed09abca7cd4c2c421c836b120..f7008f570b8447cd775cc688629f2a759ec2dd70 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3860,4 +3860,19 @@ deallocate prepare stmt; drop view v1,v2,v3; drop table t1,t2,t3; +--echo # +--echo # MDEV-10657: incorrect result returned with binary protocol +--echo # (prepared statements) +--echo # + +create table t1 (code varchar(10) primary key); +INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3'); +SELECT X.* +FROM + (SELECT CODE, RN + FROM + (SELECT A.CODE, @cnt := @cnt + 1 AS RN + FROM t1 A, (SELECT @cnt := 0) C) T + ) X; +drop table t1; --echo # End of 5.5 tests diff --git a/mysql-test/t/query_cache_debug.test b/mysql-test/t/query_cache_debug.test index 5eba778cf9e32d96f3bf9da63a43eea5d40c352c..cebe5b1c88fdef7278f50b9dfde11ebf48fa5d99 100644 --- a/mysql-test/t/query_cache_debug.test +++ b/mysql-test/t/query_cache_debug.test @@ -320,3 +320,55 @@ RESET QUERY CACHE; DROP TABLE t1; SET GLOBAL query_cache_size= DEFAULT; SET GLOBAL query_cache_type= DEFAULT; + +--echo # +--echo # MDEV-14526: MariaDB keeps crashing under load when +--echo # query_cache_type is changed +--echo # + +CREATE TABLE t1 ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `k` int(10) default '0', + PRIMARY KEY (`id`)) +ENGINE=MyISAM; + +INSERT IGNORE INTO t1 VALUES + (NULL,1),(NULL,8),(NULL,NULL),(NULL,NULL),(NULL,4),(NULL,9),(NULL,7), + (NULL,3),(NULL,NULL),(NULL,2),(NULL,3),(NULL,NULL),(NULL,2),(NULL,7), + (NULL,1),(NULL,2),(NULL,4),(NULL,NULL),(NULL,1),(NULL,1),(NULL,4); + +SET GLOBAL query_cache_size= 1024*1024; +SET GLOBAL query_cache_type= 1; + +--connect (con2,localhost,root,,test) +--connect (con1,localhost,root,,test) +set debug_sync="wait_in_query_cache_store_query SIGNAL parked WAIT_FOR go"; +--send + + SELECT DISTINCT id FROM t1 WHERE id BETWEEN 5603 AND 16218 ORDER BY k; + +--connection default + +set debug_sync="now WAIT_FOR parked"; +--connection con2 +--send + SET GLOBAL query_cache_type= 0; + +--connection default +set debug_sync="now SIGNAL go"; + +--connection con1 +--reap +--connection con2 +--reap + +# Cleanup +--disconnect con1 +--disconnect con2 +--connection default +set debug_sync= 'RESET'; +DROP TABLE t1; +SEt GLOBAL query_cache_size= DEFAULT; +SEt GLOBAL query_cache_type= DEFAULT; + +--echo # End of 5.5 tests diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index a6df0dc5979893ea9eb1d1693ecc1930a7d493be..5494e370133ff9d8f70530c425d26e03695bd00c 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -115,7 +115,7 @@ SET myisam_repair_threads=@@global.myisam_repair_threads; SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1; ---echo End of 4.1 tests +--echo # End of 4.1 tests # # BUG#36055 - mysql_upgrade doesn't really 'upgrade' tables @@ -147,7 +147,8 @@ REPAIR TABLE t1 USE_FRM; SELECT * FROM t1; DROP TABLE t1; -# End of 5.0 tests + +--echo # End of 5.0 tests # # Bug#18775 - Temporary table from alter table visible to other threads @@ -219,3 +220,21 @@ create view v1 as select * from t1; repair view v1; drop view v1; drop table t1; + +--echo # End of 5.5 tests + +# +# MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT t1 VALUES (1); +LOCK TABLE t1 WRITE; +REPAIR TABLE t1; +--disable_result_log +SELECT * FROM INFORMATION_SCHEMA.TABLES; +--enable_result_log +SELECT * FROM t1; +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of 10.0 tests diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 7453cec8f21b192db0fb6f059fb07c4fb376cee1..4b2230ea7da0567ec2fed06ee9edeceb958d96ad 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9605,4 +9605,153 @@ DROP FUNCTION f1; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-14857: problem with 10.2.11 server crashing when +--echo # executing stored procedure +--echo # + +SET max_sp_recursion_depth=10; + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); + +delimiter ||; + +CREATE PROCEDURE proc_0() +BEGIN + CALL empty_1(); + CALL proc_1(); +END || + +CREATE PROCEDURE proc_1() +BEGIN + CALL proc_2(); + CALL proc_3(); + CALL proc_4(); + CALL proc_5(); +END || + +CREATE PROCEDURE proc_2() + CALL proc_6(); +|| + +CREATE PROCEDURE proc_3() +BEGIN + CALL empty_2(); + CALL empty_3(); +END || + +CREATE PROCEDURE proc_4() + CALL proc_7(); +|| + +CREATE PROCEDURE proc_5() + CALL proc_select(); +|| + +CREATE PROCEDURE proc_6() +BEGIN + CALL empty_4(); + CALL empty_5(); + CALL empty_6(); + CALL empty_7(); + CALL proc_8(); +END || + +CREATE PROCEDURE proc_7() + CALL proc_9('foo'); +|| + +CREATE PROCEDURE proc_8() + CALL proc_10(); +|| + +CREATE PROCEDURE proc_9(IN opt VARCHAR(40)) + IF LEFT(opt,1) <> '_' THEN + CALL proc_11(); + END IF; +|| + +CREATE PROCEDURE proc_10() + CALL proc_12(); +|| + +CREATE PROCEDURE proc_11() +BEGIN + CALL empty_8(); + CALL empty_9(); + CALL empty_10(); + CALL proc_13(); +END || + +CREATE PROCEDURE proc_12() +BEGIN + CALL empty_11(); + CALL empty_12(); + CALL empty_13(); +END || + +CREATE PROCEDURE proc_13() +BEGIN + CALL proc_9('_bar'); + CALL empty_14(); +END || + +delimiter ;|| + +CREATE PROCEDURE empty_1() BEGIN END ; +CREATE PROCEDURE empty_2() BEGIN END ; +CREATE PROCEDURE empty_3() BEGIN END ; +CREATE PROCEDURE empty_4() BEGIN END ; +CREATE PROCEDURE empty_5() BEGIN END ; +CREATE PROCEDURE empty_6() BEGIN END ; +CREATE PROCEDURE empty_7() BEGIN END ; +CREATE PROCEDURE empty_8() BEGIN END ; +CREATE PROCEDURE empty_9() BEGIN END ; +CREATE PROCEDURE empty_10() BEGIN END ; +CREATE PROCEDURE empty_11() BEGIN END ; +CREATE PROCEDURE empty_12() BEGIN END ; +CREATE PROCEDURE empty_13() BEGIN END ; +CREATE PROCEDURE empty_14() BEGIN END ; + +CREATE PROCEDURE proc_select() + SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2) +; + +CALL proc_0(); + +# Cleanup +DROP PROCEDURE empty_1; +DROP PROCEDURE empty_2; +DROP PROCEDURE empty_3; +DROP PROCEDURE empty_4; +DROP PROCEDURE empty_5; +DROP PROCEDURE empty_6; +DROP PROCEDURE empty_7; +DROP PROCEDURE empty_8; +DROP PROCEDURE empty_9; +DROP PROCEDURE empty_10; +DROP PROCEDURE empty_11; +DROP PROCEDURE empty_12; +DROP PROCEDURE empty_13; +DROP PROCEDURE empty_14; +DROP PROCEDURE proc_0; +DROP PROCEDURE proc_1; +DROP PROCEDURE proc_2; +DROP PROCEDURE proc_3; +DROP PROCEDURE proc_4; +DROP PROCEDURE proc_5; +DROP PROCEDURE proc_6; +DROP PROCEDURE proc_7; +DROP PROCEDURE proc_8; +DROP PROCEDURE proc_9; +DROP PROCEDURE proc_10; +DROP PROCEDURE proc_11; +DROP PROCEDURE proc_12; +DROP PROCEDURE proc_13; +DROP PROCEDURE proc_select; +DROP TABLE t1, t2; + +SET max_sp_recursion_depth=default; + --echo #End of 10.1 tests diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index e0e3ed1a14cb4ecd7771f1bc6c823e19ac5e7f2a..717871db61d9381e95be46918138cc949e02f9b3 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -6072,6 +6072,33 @@ SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2; --echo # drop table t1, t2; +--echo # +--echo # MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in +--echo # (5.5 test) +--echo # +SET @optimiser_switch_save= @@optimizer_switch; + +CREATE TABLE t1 (a INT NOT NULL); +INSERT INTO t1 VALUES (1),(1),(1),(5),(5); + +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (5),(1); + +CREATE TABLE t3 (c INT, KEY(c)); +INSERT INTO t3 VALUES (5),(5); + +SET optimizer_switch='semijoin=on'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); + +SET optimizer_switch='semijoin=off'; +select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`) +and t1.a in (select `test`.`t3`.`c` from `test`.`t3`); + +SET @@optimizer_switch= @optimiser_switch_save; +DROP TABLE t1, t2, t3; + +--echo End of 5.5 tests --echo # End of 10.0 tests --echo # diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 059bf9154cb7cb62876d4fb39869c6dfc48d23b4..cbd19a73a807514cb11ca908c88de868f6bdae52 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -1418,6 +1418,43 @@ select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub; drop table t1,t2,t3; +--echo # +--echo # MDEV-14715 Assertion `!table || (!table->read_set || +--echo # bitmap_is_set(table->read_set, field_index))' +--echo # failed in Field_num::val_decimal +--echo # + +CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM; +CREATE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1, NULL),(3, 4); + +--error ER_INVALID_GROUP_FUNC_USE +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + sum(a)) +UNION +(SELECT 2, 2); + +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1) +UNION +(SELECT 2, 2); + +SELECT a, b FROM t1 +UNION +(SELECT a, VAR_POP(a) AS f FROM v1 GROUP BY a ORDER BY b/a ); + +DROP TABLE t1; + +--error ER_VIEW_INVALID +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1) +UNION +(SELECT 2, 2); + +DROP VIEW v1; + +--error ER_NO_SUCH_TABLE +(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1) +UNION +(SELECT 2, 2); + --echo End of 5.5 tests --echo # diff --git a/mysql-test/t/update_innodb.test b/mysql-test/t/update_innodb.test index 0e93e7d959375bb31ec1458212551f84805cd44e..acc8aceab00708907c4234e8521b51d623ef674c 100644 --- a/mysql-test/t/update_innodb.test +++ b/mysql-test/t/update_innodb.test @@ -38,6 +38,18 @@ UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON v drop view v1; drop table t1,t2,t3,t4; +--echo # +--echo # MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field +--echo # + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (b INT) ENGINE=InnoDB; +DELETE FROM v1 WHERE a IN ( SELECT a FROM t2 ); +DELETE FROM v1 WHERE (a,a) IN ( SELECT a,a FROM t2 ); +drop view v1; +drop table t1,t2; + --echo # --echo # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt --echo # diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 1709886eb0c30d0a4805f19f807c14df901cff15..0995b8c26b20ebdceab3d9e64e3c4a9568a4b01a 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -327,6 +327,20 @@ SELECT * FROM t1; DROP TABLE t1; +--echo # +--echo # MDEV-14609 XA Transction unable to ROLLBACK TO SAVEPOINT +--echo # + +CREATE TABLE t1 (c1 INT) ENGINE=INNODB; +XA START 'xa1'; +SAVEPOINT savepoint1; +INSERT INTO t1 (c1) VALUES (1),(2),(3),(4); +ROLLBACK TO SAVEPOINT savepoint1; +XA END 'xa1'; +XA ROLLBACK 'xa1'; +DROP TABLE t1; + + --echo # --echo # Bug#12352846 - TRANS_XA_START(THD*): --echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL() diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index ae7e9058e26709a20861efd0c01a46711f3811a3..c68790b704556a0385bd2037dc816dd9d2db441f 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -748,6 +748,15 @@ SELECT *,IF(@i:=c1,ExtractValue('b1b2','//b[$@i]'),0) AS xp SELECT * FROM t1 WHERE c2=IF(@i:=c1,ExtractValue('b1b2','//b[$@i]'),0); DROP TABLE t1; +--echo # +--echo # MDEV-15118 ExtractValue(xml,something_complex) does not work +--echo # + +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CONCAT('aaa')); +SELECT ExtractValue(a, '/a') AS a FROM t1; +SELECT ExtractValue(a, FROM_BASE64(TO_BASE64('/a'))) AS a FROM t1; +DROP TABLE t1; --echo # --echo # End of 10.0 tests diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 3010c5ddf797ceff1c027d8b1979c7bf61c9ceb5..34639ef321f991d3b54027ec26f6cf0c72a6f8cb 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,87 +23,74 @@ # ############################################################################## -main.alter_table : Modified in 10.1.29 main.alter_table_trans : MDEV-12084 - timeout main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 -main.bootstrap : Include files modified in 10.1.29 -main.case : Modified in 10.1.29 +main.create : Modified in 10.1.31 main.create_delayed : MDEV-10605 - failed with timeout -main.ctype_gbk : Modified in 10.1.29 -main.ctype_latin1 : Modified in 10.1.29 -main.ctype_ucs : Modified in 10.1.29 main.ctype_utf16le : MDEV-10675: timeout or extra warnings -main.ctype_utf32 : Modified in 10.1.29 main.ctype_utf8 : Modified in 10.1.30 main.ctype_utf8mb4 : Modified in 10.1.30 -main.delete_returning : Modified in 10.1.29 -main.delimiter_command_case_sensitivity : Added in 10.1.29 +main.derived : Modified in 10.1.31 +main.dyncol : Modified in 10.1.31 main.events_2 : MDEV-13277 - Server crash main.events_bugs : MDEV-12892 - Crash in fill_schema_processlist main.events_restart : MDEV-12236 - Server shutdown problem -main.func_in : Modified in 10.1.29 -main.func_misc : Modified in 10.1.29 -main.func_regexp_pcre : Modified in 10.1.29 +main.fulltext : Modified in 10.1.31 +main.func_concat : Modified in 10.1.31 +main.func_isnull : Modified in 10.1.31 main.func_set : Modified in 10.1.30 main.func_str : Modified in 10.1.30 -main.func_time : Modified in 10.1.29 -main.gis-precise : Modified in 10.1.29 main.group_by : Modified in 10.1.30 main.having : Modified in 10.1.30 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Wrong execution plan, timeout with valgrind -main.information_schema : Modified in 10.1.29 main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure +main.join_cache : Modified in 10.1.31 main.join_outer : Modified in 10.1.30 main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist +main.mdev_14586 : Added in 10.1.31 main.mdev-504 : MDEV-10607 - sporadic "can't connect" -main.mdev13607 : Added in 10.1.29 main.mdev375 : MDEV-10607 - sporadic "can't connect" -main.merge : MDEV-10607 - sporadic "can't connect" -main.myisam : Modified in 10.1.29 +main.merge : MDEV-10607 - sporadic "can't connect"; modified in 10.1.31 +main.myisam_optimize : Modified in 10.1.31 +main.mysql_client_test_nonblock : MDEV-15096 - exec failed main.mysql_upgrade_noengine : MDEV-14355 - Plugin is busy -main.mysqlbinlog : Modified in 10.1.29 +main.mysqldump-nl : Modified in 10.1.31 main.mysqlslap : MDEV-11801 - timeout main.mysqltest : MDEV-9269 - fails on Alpha +main.order_by : Modified in 10.1.31 main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan -main.partition_datatype : Modified in 10.1.29 -main.partition_example : Include files modified in 10.1.29 +main.partition : Modified in 10.1.31 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings -main.plugin : Include files modified in 10.1.29 -main.plugin_innodb : Include files modified in 10.1.29 -main.plugin_load : Include files modified in 10.1.29 -main.plugin_load_option : Include files modified in 10.1.29 -main.plugin_maturity : Include files modified in 10.1.29 -main.plugin_not_embedded : Include files modified in 10.1.29 -main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.1.29 +main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.1.31 main.query_cache : MDEV-12895 - Wrong result -main.range_vs_index_merge : Modified in 10.1.29 +main.query_cache_debug : Modified in 10.1.31 main.range_vs_index_merge_innodb : MDEV-12637 - Timeout -main.read_only : Modified in 10.1.29 +main.repair : Modified in 10.1.31 main.set_statement : MDEV-13183 - Wrong result main.show_explain : MDEV-10674 - sporadic failure -main.show_function_with_pad_char_to_full_length : Added in 10.1.29 -main.sp : Modified in 10.1.30 +main.sp : Modified in 10.1.31 main.sp-security : MDEV-10607 - sporadic "can't connect" main.status : MDEV-8510 - sporadic wrong result -main.subselect_exists2in : Modified in 10.1.29 +main.subselect : Modified in 10.1.31 main.subselect_innodb : MDEV-10614 - sporadic wrong results -main.subselect_mat_cost_bugs : Modified in 10.1.29 -main.table_options-5867 : Include files modified in 10.1.29 +main.symlink-aria-11902 : MDEV-15098 - error 40 from storage engine +main.symlink-myisam-11902 : MDEV-15098 - error 40 from storage engine +main.tc_heuristic_recover : MDEV-15200 - wrong error on mysqld_stub_cmd main.trigger : Modified in 10.1.30 -main.truncate_badse : Include files modified in 10.1.29 -main.type_bit : Modified in 10.1.29 -main.type_date : Modified in 10.1.29 +main.type_blob : MDEV-15195 - Wrong result main.type_datetime_hires : MDEV-10687 - timeout -main.type_varchar : Modified in 10.1.29 -main.user_var : Modified in 10.1.29 +main.union : Modified in 10.1.31 +main.update_innodb : Modified in 10.1.31 main.view : Modified in 10.1.30 -main.xml : Modified in 10.1.30 +main.xa : Modified in 10.1.31 +main.xml : Modified in 10.1.31 #---------------------------------------------------------------- +archive.archive_bitfield : MDEV-11771 - Extra warning archive.discover : MDEV-10510 - Table is marked as crashed archive.mysqlhotcopy_archive : MDEV-14726 - Table is marked as crashed @@ -113,7 +100,6 @@ binlog.binlog_commit_wait : MDEV-10150 - Error: too much time el binlog.binlog_flush_binlogs_delete_domain : MDEV-14431 - Wrong error code; added in 10.1.30 binlog.binlog_gtid_delete_domain_debug : Added in 10.1.30 binlog.binlog_killed : MDEV-12925 - Wrong result -binlog.binlog_spurious_ddl_errors : Include files modified in 10.1.29 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint #---------------------------------------------------------------- @@ -121,34 +107,25 @@ binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync binlog_encryption.rpl_parallel : MDEV-10653 - Timeout +binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning binlog_encryption.rpl_ssl : MDEV-14507 - Timeout on SLES 11.4 binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query #---------------------------------------------------------------- -connect.json_java_2 : Include file modified in 10.1.29 -connect.json_java_3 : Include file modified in 10.1.29 -connect.json_mongo_c : Include file modified in 10.1.29 -connect.mongo_c : Include file modified in 10.1.29 -connect.mongo_java_2 : Include file modified in 10.1.29 -connect.mongo_java_3 : Include file modified in 10.1.29 -connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results -connect.tbl_thread : MDEV-9844, MDEV-10179, MDEV-14214 - sporadic crashes, valgrind warnings, wrong results +connect.pivot : MDEV-14803 - failed to discover table connect.zip : MDEV-13884 - Wrong result #---------------------------------------------------------------- encryption.create_or_replace : MDEV-9359 - Assertion failure, MDEV-13516 - Assertion failure -encryption.debug_key_management : MDEV-13841 - Timeout on wait condition -encryption.encrypt_and_grep : MDEV-13765 - Wrong result -encryption.encryption_force : Modified in 10.1.29 -encryption.filekeys_encfile : Include file modified in 10.1.29 -encryption.filekeys_encfile_file : Include file modified in 10.1.29 +encryption.debug_key_management : MDEV-13841 - Timeout on wait condition; modified in 10.1.31 +encryption.encrypt_and_grep : MDEV-13765 - Wrong result; modified in 10.1.31 encryption.innodb-bad-key-change2 : MDEV-12632 - Valgrind warnings encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb-discard-import-change : MDEV-12632 - Valgrind warnings -encryption.innodb-encryption-alter : Modified in 10.1.29 +encryption.innodb_encryption : Modified in 10.1.31 encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result encryption.innodb_encryption_filekeys : MDEV-9962 - timeouts encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure @@ -170,11 +147,12 @@ engines/funcs.* : Not maintained in timely manner #---------------------------------------------------------------- -federated.federated_bug_585688 : MDEV-12907 - Valgrind +federated.federated_bug_585688 : MDEV-12907 - Valgrind, MDEV-14805 - server crash federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips federated.federated_partition : MDEV-10417 - Fails on Mips federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips federated.federatedx : MDEV-10617 - Wrong checksum, timeouts +federated.net_thd_crash-12951 : Added in 10.1.31 #---------------------------------------------------------------- @@ -204,61 +182,51 @@ galera.MW-328A : MDEV-13876 - Wrong result #---------------------------------------------------------------- innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.doublewrite : MDEV-12905, MDEV-14205 - Lost connection to MySQL server +innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server innodb_fts.fulltext2 : MDEV-14727 - Long semaphore wait -innodb.innodb-16k : Modified in 10.1.29 -innodb.innodb-32k : Modified in 10.1.29 -innodb.innodb-64k : Modified in 10.1.29 +innodb.innodb : Opt file modified in 10.1.31 innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup -innodb.innodb-alter : Modified in 10.1.29 innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS -innodb.innodb-alter-table : MDEV-10619 - Testcase timeout; modified in 10.1.29 +innodb.innodb-alter-table : MDEV-10619 - Testcase timeout innodb.innodb-autoinc : Modified in 10.1.30 innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb_bug14147491 : MDEV-11808 - wrong error codes innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan innodb.innodb_bug48024 : MDEV-14352 - Assertion failure +innodb.innodb_corrupt_bit : Modified in 10.1.31 innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown -innodb.innodb-get-fk : Modified in 10.1.29 +innodb.innodb-index-online : Modified in 10.1.31 +innodb.innodb-lru-force-no-free-page : Added in 10.1.31 +innodb.innodb_max_recordsize_64k : MDEV-15203 - wrong result innodb.innodb-page_compression_lzma : MDEV-14353 - wrong result on Fedora 25 -innodb.innodb-page_compression_tables : Modified in 10.1.29 innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem -innodb.innodb-replace-debug : Added in 10.1.30 +innodb.innodb-replace-debug : Modified in 10.1.31 innodb.innodb_stats : MDEV-10682 - wrong result innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result -innodb.innodb-table-online : Modified in 10.1.29 -innodb.innodb-wl5522-debug : Modified in 10.1.29 -innodb.innodb-wl5980-alter : Modified in 10.1.29 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks +innodb.log_file_size : MDEV-15202 - Cannot resize log files in read-only mode innodb.recovery_shutdown : Added in 10.1.30 -innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; opt file modified in 10.1.30 +innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace +innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; opt file modified in 10.1.31 innodb.table_flags : MDEV-14363 - Operating system error number 2 -innodb.undo_log : Modified in 10.1.29 -innodb_fts.concurrent_insert : Added in 10.1.29 -innodb_fts.fulltext : Modified in 10.1.29 innodb_fts.fulltext_misc : MDEV-12636 - Valgrind warnings -innodb_zip.innodb_prefix_index_liftedlimit : Modified in 10.1.29 -innodb_zip.wl5522_debug_zip : Added in 10.1.29 - #---------------------------------------------------------------- -maria.maria : MDEV-14430 - Wrong result; modified in 10.1.29 +maria.lock : Modified in 10.1.31 +maria.maria : MDEV-14430 - Wrong result; modified in 10.1.31 +maria.repair : Added in 10.1.31 #---------------------------------------------------------------- -mariabackup.compress_qpress : Added in 10.1.29 -mariabackup.data_directory : Added in 10.1.29 -mariabackup.incremental_backup : Modified in 10.1.29 -mariabackup.mdev-14447 : Added in 10.1.30 -mariabackup.partition_datadir : Added in 10.1.29 +mariabackup.huge_lsn : Added in 10.1.31 +mariabackup.mdev-14447 : MDEV-15201 - Timeout; added in 10.1.30 +mariabackup.missing_ibd : Added in 10.1.31 +mariabackup.xb_compressed_encrypted : MDEV-14812 - Segfault #---------------------------------------------------------------- -mroonga.* : Many tests and include files added and modified in 10.1.29 -mroonga/storage.* : Many tests and include files added and modified in 10.1.29 - mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha @@ -266,7 +234,7 @@ mroonga/storage.column_datetime_32bit_out_of_range : Wrong resul mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - valgrind warnings -mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result +mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result, MDEV-14807 - wrong error message mroonga/storage.variable_query_log_file_disabled_empty_value : Modified in 10.1.30 mroonga/storage.variable_query_log_file_disabled_null_value : Modified in 10.1.30 mroonga/storage.variable_query_log_file_enabled_empty_value : Modified in 10.1.30 @@ -274,6 +242,8 @@ mroonga/storage.variable_query_log_file_enabled_null_value : Modified in mroonga/storage.variable_query_log_file_new_value : Modified in 10.1.30 mroonga/storage.variable_query_log_file_same_value : Modified in 10.1.30 +mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message + #---------------------------------------------------------------- multi_source.gtid : MDEV-10417 - Fails on Mips @@ -287,9 +257,10 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_h parts.partition_alter_innodb : Added in 10.1.30 parts.partition_alter_maria : Modified in 10.1.30 -parts.partition_alter_myisam : Added in 10.1.30 +parts.partition_alter_myisam : Modified in 10.1.31 parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query parts.partition_auto_increment_maria : MDEV-14430 - Wrong result +parts.partition_debug_innodb : MDEV-15095 - table does not exist parts.partition_innodb_status_file : MDEV-12901 - Valgrind #---------------------------------------------------------------- @@ -308,12 +279,11 @@ perfschema.threads_mysql : MDEV-10677 - sporadic wrong resul plugins.binlog-simple_plugin_check : Added in 10.1.30 plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url -plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.29 -plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.1.29 +plugins.server_audit : MDEV-9562 - crashes on sol10-sparc +plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc #---------------------------------------------------------------- -roles.definer : Modified in 10.1.29 roles.flush_roles-12366 : Added in 10.1.30 roles.set_role-13655 : Added in 10.1.30 @@ -324,7 +294,6 @@ rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master -rpl.rpl_checksum_cache : MDEV-12173 - Unexpected error rpl.rpl_ddl : MDEV-10417 - Fails on Mips rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result @@ -338,8 +307,10 @@ rpl.rpl_gtid_until : MDEV-10625 - warnings in error log rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_id : MDEV-15197 - Wrong result rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips +rpl.rpl_manual_change_index_file : Modified in 10.1.31 rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed @@ -354,11 +325,11 @@ rpl.rpl_parallel_retry : MDEV-11119 - Server crash rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings -rpl.rpl_plugin_load : Include files modified in 10.1.29 rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_min : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed +rpl.rpl_row_index_choice : MDEV-15196 - Slave crash rpl.rpl_row_log : Include file modified in 10.1.30 rpl.rpl_row_log_innodb : Include file modified in 10.1.30 rpl.rpl_row_mixing_engines : MDEV-14491 - Long semaphore wait @@ -377,7 +348,6 @@ rpl.rpl_stm_log : Include file modified in 10.1.30 rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion rpl.rpl_sync : MDEV-10633 - Database page corruption -rpl.rpl_table_options : Include files modified in 10.1.29 rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result @@ -415,21 +385,17 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x -sys_vars.explicit_defaults_for_timestamp_off : Include file modified in 10.1.29 -sys_vars.explicit_defaults_for_timestamp_on : Include file modified in 10.1.29 sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout -sys_vars.innodb_buffer_pool_dump_now_basic : Modified in 10.1.29 -sys_vars.innodb_buffer_pool_dump_pct_basic : Modified in 10.1.29 -sys_vars.innodb_buffer_pool_load_now_basic : Modified in 10.1.29 sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes +sys_vars.innodb_print_lock_wait_timeout_info_basic : Added in 10.1.31 sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - wrong results -sys_vars.sysvars_wsrep : MDEV-12522 - Dependency on specific wsrep_provider sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result sys_vars.wait_timeout_func : MDEV-12896 - Wrong result #---------------------------------------------------------------- +tokudb.card_scale_percent : Modified in 10.1.31 tokudb.change_column_all_1000_10 : MDEV-12640 - Crash tokudb.change_column_bin : MDEV-12640 - Crash tokudb.change_column_char : MDEV-12822 - Lost connection to MySQL server @@ -440,9 +406,15 @@ tokudb.dir_per_db : MDEV-11537 - Wrong result tokudb.dir_per_db_rename_to_nonexisting_schema : MDEV-14359 - Directory not empty tokudb.hotindex-insert-bigchar : MDEV-12640 - Crash tokudb.hotindex-insert-1 : MDEV-13870 - Lost connection to MySQL server +tokudb.hotindex-update-0 : MDEV-15198 - Timeout tokudb.hotindex-update-1 : MDEV-12640 - Crash +tokudb.locking-read-repeatable-read-1 : Added in 10.1.31 +tokudb.locking-read-repeatable-read-2 : Added in 10.1.31 +tokudb.nonflushing_analyze_debug : Added in 10.1.31 +tokudb.row_format : Modified in 10.1.31 tokudb.rows-32m-rand-insert : MDEV-12640 - Crash tokudb.rows-32m-seq-insert : MDEV-12640 - Crash +tokudb.type_datetime : MDEV-15193 - Wrong result tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output @@ -450,6 +422,11 @@ tokudb_bugs.xa : MDEV-11804 - Lock wait timeout tokudb_mariadb.mdev6657 : MDEV-12737 - Wrong plan, valgrind warnings +tokudb_parts.nonflushing_analyze_debug : Added in 10.1.31 + +tokudb_perfschema.crash_tokudb : Added in 10.1.31 +tokudb_perfschema.start_server_tokudb : Added in 10.1.31 + rpl-tokudb.rpl_tokudb_row_log : Include file modified in 10.1.30 rpl-tokudb.rpl_tokudb_stm_log : Include file modified in 10.1.30 @@ -462,7 +439,6 @@ unit.ma_test_loghandler : MDEV-10638 - record read not ok vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout -vcol.vcol_misc : Modified in 10.1.29 #---------------------------------------------------------------- diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index c46e9cd445639a207caefb4b955cc0a23ae1748c..1c5a4152292a8b91397375a09ad98914c1f77d28 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -3818,6 +3818,58 @@ mariadb_dyncol_check(DYNAMIC_COLUMN *str) DBUG_RETURN(rc); } +static +my_bool dynstr_append_json_quoted(DYNAMIC_STRING *str, + const char *append, size_t len) +{ + uint additional= ((str->alloc_increment && str->alloc_increment > 6) ? + str->alloc_increment : + 10); + uint lim= additional; + uint i; + if (dynstr_realloc(str, len + additional + 2)) + return TRUE; + str->str[str->length++]= '"'; + for (i= 0; i < len; i++) + { + register char c= append[i]; + if (unlikely(c <= 0x1F)) + { + if (lim < 5) + { + if (dynstr_realloc(str, additional)) + return TRUE; + lim+= additional; + } + lim-= 5; + str->str[str->length++]= '\\'; + str->str[str->length++]= 'u'; + str->str[str->length++]= '0'; + str->str[str->length++]= '0'; + str->str[str->length++]= (c < 0x10 ? '0' : '1'); + c%= 0x10; + str->str[str->length++]= (c < 0xA ? '0' + c : 'A' + (c - 0xA)); + } + else + { + if (c == '"' || c == '\\') + { + if (!lim) + { + if (dynstr_realloc(str, additional)) + return TRUE; + lim= additional; + } + lim--; + str->str[str->length++]= '\\'; + } + str->str[str->length++]= c; + } + } + str->str[str->length++]= '"'; + return FALSE; +} + enum enum_dyncol_func_result mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, @@ -3883,7 +3935,10 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, return ER_DYNCOL_RESOURCE; } if (quote) - rc= dynstr_append_quoted(str, from, len, quote); + if (quote == DYNCOL_JSON_ESC) + rc= dynstr_append_json_quoted(str, from, len); + else + rc= dynstr_append_quoted(str, from, len, quote); else rc= dynstr_append_mem(str, from, len); if (alloc) @@ -4183,7 +4238,8 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json, } else { - if ((rc= mariadb_dyncol_val_str(json, &val, DYNCOL_UTF, '"')) < 0) + if ((rc= mariadb_dyncol_val_str(json, &val, DYNCOL_UTF, DYNCOL_JSON_ESC)) + < 0) goto err; } } diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index d861c2c3d4f4e6b82ab636e725e7ab86294e69d1..a0ddc3e40a5bb9188a603d5e8cc633c5207c4260 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -300,7 +300,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, else { /* Clear mutex so that safe_mutex will notice that it's not initialized */ - bzero((char*) &info->append_buffer_lock, sizeof(info)); + bzero((char*) &info->append_buffer_lock, sizeof(info->append_buffer_lock)); } #endif diff --git a/mysys/my_addr_resolve.c b/mysys/my_addr_resolve.c index 72b04119855accef1c67c86218fa16a98f38b973..82043dc03fed8553634fb3682d9151616074f2fd 100644 --- a/mysys/my_addr_resolve.c +++ b/mysys/my_addr_resolve.c @@ -133,16 +133,52 @@ const char *my_addr_resolve_init() #include #include -#if defined(HAVE_LINK_H) && defined(HAVE_DLOPEN) -#include -static ptrdiff_t offset= 0; -#else -#define offset 0 -#endif +#include static int in[2], out[2]; -static int initialized= 0; +static pid_t pid; +static char addr2line_binary[1024]; static char output[1024]; + +int start_addr2line_fork(const char *binary_path) +{ + + if (pid > 0) + { + /* Don't leak FDs */ + close(in[1]); + close(out[0]); + /* Don't create zombie processes. */ + waitpid(pid, NULL, 0); + } + + if (pipe(in) < 0) + return 1; + if (pipe(out) < 0) + return 1; + + pid = fork(); + if (pid == -1) + return 1; + + if (!pid) /* child */ + { + dup2(in[0], 0); + dup2(out[1], 1); + close(in[0]); + close(in[1]); + close(out[0]); + close(out[1]); + execlp("addr2line", "addr2line", "-C", "-f", "-e", binary_path, NULL); + exit(1); + } + + close(in[0]); + close(out[1]); + + return 0; +} + int my_addr_resolve(void *ptr, my_addr_loc *loc) { char input[32]; @@ -150,26 +186,47 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) ssize_t total_bytes_read = 0; ssize_t extra_bytes_read = 0; + ssize_t parsed = 0; fd_set set; struct timeval timeout; int filename_start = -1; int line_number_start = -1; - ssize_t i; - FD_ZERO(&set); - FD_SET(out[0], &set); + Dl_info info; + void *offset; + + if (!dladdr(ptr, &info)) + return 1; + if (strcmp(addr2line_binary, info.dli_fname)) + { + /* We use dli_fname in case the path is longer than the length of our static + string. We don't want to allocate anything dynamicaly here as we are in + a "crashed" state. */ + if (start_addr2line_fork(info.dli_fname)) + { + addr2line_binary[0] = '\0'; + return 1; + } + /* Save result for future comparisons. */ + strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary)); + } + offset = info.dli_fbase; len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset); if (write(in[1], input, len) <= 0) return 1; - /* 10 ms should be plenty of time for addr2line to issue a response. */ + FD_ZERO(&set); + FD_SET(out[0], &set); + + /* 100 ms should be plenty of time for addr2line to issue a response. */ timeout.tv_sec = 0; - timeout.tv_usec = 10000; + timeout.tv_usec = 100000; /* Read in a loop till all the output from addr2line is complete. */ - while (select(out[0] + 1, &set, NULL, NULL, &timeout) > 0) + while (parsed == total_bytes_read && + select(out[0] + 1, &set, NULL, NULL, &timeout) > 0) { extra_bytes_read= read(out[0], output + total_bytes_read, sizeof(output) - total_bytes_read); @@ -180,35 +237,33 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) break; total_bytes_read += extra_bytes_read; - } - - /* Failed starting addr2line. */ - if (total_bytes_read == 0) - return 1; - /* Go through the addr2line response and get the required data. - The response is structured in 2 lines. The first line contains the function - name, while the second one contains : */ - for (i = 0; i < total_bytes_read; i++) { - if (output[i] == '\n') { - filename_start = i + 1; - output[i] = '\0'; - } - if (filename_start != -1 && output[i] == ':') { - line_number_start = i + 1; - output[i] = '\0'; - } - if (line_number_start != -1) { - loc->line= atoi(output + line_number_start); - break; + /* Go through the addr2line response and get the required data. + The response is structured in 2 lines. The first line contains the function + name, while the second one contains : */ + for (; parsed < total_bytes_read; parsed++) + { + if (output[parsed] == '\n') + { + filename_start = parsed + 1; + output[parsed] = '\0'; + } + if (filename_start != -1 && output[parsed] == ':') + { + line_number_start = parsed + 1; + output[parsed] = '\0'; + break; + } } } + /* Response is malformed. */ if (filename_start == -1 || line_number_start == -1) return 1; loc->func= output; loc->file= output + filename_start; + loc->line= atoi(output + line_number_start); /* Addr2line was unable to extract any meaningful information. */ if (strcmp(loc->file, "??") == 0) @@ -221,41 +276,6 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc) const char *my_addr_resolve_init() { - if (!initialized) - { - pid_t pid; - -#if defined(HAVE_LINK_H) && defined(HAVE_DLOPEN) - struct link_map *lm = (struct link_map*) dlopen(0, RTLD_NOW); - if (lm) - offset= lm->l_addr; -#endif - - if (pipe(in) < 0) - return "pipe(in)"; - if (pipe(out) < 0) - return "pipe(out)"; - - pid = fork(); - if (pid == -1) - return "fork"; - - if (!pid) /* child */ - { - dup2(in[0], 0); - dup2(out[1], 1); - close(in[0]); - close(in[1]); - close(out[0]); - close(out[1]); - execlp("addr2line", "addr2line", "-C", "-f", "-e", my_progname, NULL); - exit(1); - } - - close(in[0]); - close(out[1]); - initialized= 1; - } return 0; } #endif diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 7275f602525ce19b2975a3fddadddf7f76002f24..1b0ef857afae1e3a47e5688bedbfcec0021de251 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -26,6 +26,8 @@ #define MALLOC_FLAG(A) ((A & 1) ? MY_THREAD_SPECIFIC : 0) +#define TRASH_MEM(X) TRASH_FREE(((char*)(X) + ((X)->size-(X)->left)), (X)->left) + /* Initialize memory root @@ -73,12 +75,13 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, if (pre_alloc_size) { if ((mem_root->free= mem_root->pre_alloc= - (USED_MEM*) my_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)), - MYF(my_flags)))) + (USED_MEM*) my_malloc(pre_alloc_size + ALIGN_SIZE(sizeof(USED_MEM)), + MYF(my_flags)))) { mem_root->free->size= pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM)); mem_root->free->left= pre_alloc_size; mem_root->free->next= 0; + TRASH_MEM(mem_root->free); } } #endif @@ -148,6 +151,7 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, mem->left= pre_alloc_size; mem->next= *prev; *prev= mem_root->pre_alloc= mem; + TRASH_MEM(mem); } else { @@ -248,6 +252,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) next->size= get_size; next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); *prev=next; + TRASH_MEM(next); } point= (uchar*) ((char*) next+ (next->size-next->left)); @@ -316,8 +321,6 @@ void *multi_alloc_root(MEM_ROOT *root, ...) DBUG_RETURN((void*) start); } -#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left) - /* Mark all data in blocks free for reusage */ static inline void mark_blocks_free(MEM_ROOT* root) diff --git a/mysys/my_default.c b/mysys/my_default.c index dba22c4e58b07a3413093db4fbbcbe4360395053..2358aed8f3bed201cbb8b4839494ec35cd00b6f3 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -1,4 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2011, 2018, 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 @@ -233,7 +234,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, (char **) &my_defaults_group_suffix); if (! my_defaults_group_suffix) - my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV)); + my_defaults_group_suffix= getenv("MYSQL_GROUP_SUFFIX"); if (forced_extra_defaults && !defaults_already_read) { diff --git a/mysys/my_lib.c b/mysys/my_lib.c index abc7b8a31614678cf6978c5a9be3753070d78e5a..8daed1101ecc86c39ba94482fb9ad958479da565 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -119,10 +119,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) DBUG_ENTER("my_dir"); DBUG_PRINT("my",("path: '%s' MyFlags: %lu",path,MyFlags)); -#if !defined(HAVE_READDIR_R) - mysql_mutex_lock(&THR_LOCK_open); -#endif - tmp_file= directory_file_name(tmp_path, path); if (!(dirp= opendir(tmp_path))) @@ -174,9 +170,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) } (void) closedir(dirp); -#if !defined(HAVE_READDIR_R) - mysql_mutex_unlock(&THR_LOCK_open); -#endif if (MyFlags & MY_WANT_SORT) sort_dynamic(&dirh->array, (qsort_cmp) comp_names); @@ -187,9 +180,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) DBUG_RETURN(&dirh->dir); error: -#if !defined(HAVE_READDIR_R) - mysql_mutex_unlock(&THR_LOCK_open); -#endif my_errno=errno; if (dirp) (void) closedir(dirp); diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index 1d3c3059bd5dfd48ef260245669556d9927fe80f..f827fb136d36eb468f1b14f00727b65cbe0a78ff 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -385,7 +385,6 @@ void my_thread_end(void) /* Trash variable so that we can detect false accesses to my_thread_var */ tmp->init= 2; - TRASH(tmp, sizeof(*tmp)); free(tmp); } } diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc index a0937a83e1748a84df6e65016b1647ac93fee22d..439339423cd56fe8ad7ccc462331728c6f2f33c6 100644 --- a/mysys_ssl/my_crypt.cc +++ b/mysys_ssl/my_crypt.cc @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef HAVE_ERR_remove_thread_state #define ERR_remove_state(X) ERR_remove_thread_state(NULL) @@ -292,31 +293,11 @@ unsigned int my_aes_ctx_size(enum my_aes_mode) return MY_AES_CTX_SIZE; } -#ifdef HAVE_YASSL -#include -int my_random_bytes(uchar* buf, int num) -{ - TaoCrypt::RandomNumberGenerator rand; - rand.GenerateBlock((TaoCrypt::byte*) buf, num); - return MY_AES_OK; -} -#else -#include - int my_random_bytes(uchar *buf, int num) { - /* - Unfortunately RAND_bytes manual page does not provide any guarantees - in relation to blocking behavior. Here we explicitly use SSLeay random - instead of whatever random engine is currently set in OpenSSL. That way - we are guaranteed to have a non-blocking random. - */ - RAND_METHOD *rand = RAND_SSLeay(); - if (rand == NULL || rand->bytes(buf, num) != 1) + if (RAND_bytes(buf, num) != 1) return MY_AES_OPENSSL_ERROR; return MY_AES_OK; } -#endif } - diff --git a/mysys_ssl/yassl.cc b/mysys_ssl/yassl.cc index 9717870fe2644c29d24c73879f2348f77f56897d..e9f8e650347ed84d1006c20253b561de81cf271c 100644 --- a/mysys_ssl/yassl.cc +++ b/mysys_ssl/yassl.cc @@ -26,6 +26,7 @@ #include "aes.hpp" using yaSSL::yaERR_remove_state; +using yaSSL::yaRAND_bytes; #define EVP_CIPH_ECB_MODE 0x1 #define EVP_CIPH_CBC_MODE 0x2 diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index de2e653c4972260da9f305e04c53c236cbe4a0cc..09de67217627e88587ed722c53273ee8d3499abb 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -68,7 +68,7 @@ parse_arguments() { wsrep_recover_position() { # Redirect server's error log to the log file. - eval /usr/sbin/mysqld $cmdline_args --user=$user --wsrep_recover \ + eval @sbindir@/mysqld $cmdline_args --user=$user --wsrep_recover \ --disable-log-error 2> "$log_file" ret=$? if [ $ret -ne 0 ]; then diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index aad9ef5cc37c9b713babd0bd588346e31263eb2e..2768faccd694b3c2f78d0369e0d80cc2f0395467 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -27,6 +27,7 @@ srcdir="" args="" defaults="" +defaults_group_suffix="" mysqld_opt="" user="" @@ -64,6 +65,9 @@ Usage: $0 [OPTIONS] --defaults-extra-file=name Read this file after the global files are read. --defaults-file=name Only read default options from the given file name. + --defaults-group-suffix=name + In addition to the given groups, read also groups with + this suffix --force Causes mysql_install_db to run even if DNS does not work. In that case, grant table entries that normally use hostnames will use IP addresses. @@ -146,6 +150,8 @@ parse_arguments() --help) usage ;; --no-defaults|--defaults-file=*|--defaults-extra-file=*) defaults="$arg" ;; + --defaults-group-suffix=*) + defaults_group_suffix="$arg" ;; --cross-bootstrap|--windows) # Used when building the MariaDB system tables on a different host than @@ -287,7 +293,7 @@ fi # Now we can get arguments from the groups [mysqld] and [mysql_install_db] # in the my.cfg file, then re-run to merge with command line arguments. -parse_arguments `"$print_defaults" $defaults --mysqld mysql_install_db` +parse_arguments `"$print_defaults" $defaults $defaults_group_suffix --mysqld mysql_install_db` parse_arguments PICK-ARGS-FROM-ARGV "$@" # Configure paths to support files @@ -451,7 +457,7 @@ fi mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_install_cmd_line() { - "$mysqld_bootstrap" $defaults "$mysqld_opt" --bootstrap \ + "$mysqld_bootstrap" $defaults $defaults_group_suffix "$mysqld_opt" --bootstrap \ "--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --enforce-storage-engine="" \ $args --max_allowed_packet=8M \ --net_buffer_length=16K @@ -485,7 +491,7 @@ else echo echo "You can also try to start the mysqld daemon with:" echo - echo " shell> $mysqld --skip-grant --general-log &" + echo " shell> $mysqld --skip-grant-tables --general-log &" echo echo "and use the command line tool $bindir/mysql" echo "to connect to the mysql database and look at the grant tables:" @@ -496,8 +502,8 @@ else echo "Try 'mysqld --help' if you have problems with paths. Using" echo "--general-log gives you a log in $ldata that may be helpful." link_to_help - echo "MariaDB is hosted on launchpad; You can find the latest source and" - echo "email lists at http://launchpad.net/maria" + echo "You can find the latest source at https://downloads.mariadb.org and" + echo "the maria-discuss email list at https://launchpad.net/~maria-discuss" echo echo "Please check all of the above before submitting a bug report" echo "at http://mariadb.org/jira" diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 788e1a12f373bc16dc63ee59e59d0153b3e9c7bd..a8f671de2247bee3cd82142cb94a2882a42f4fdb 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -20,13 +20,13 @@ set -u WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_BINLOG="" -WSREP_SST_OPT_CONF_SUFFIX="" WSREP_SST_OPT_DATA="" WSREP_SST_OPT_AUTH=${WSREP_SST_OPT_AUTH:-} WSREP_SST_OPT_USER=${WSREP_SST_OPT_USER:-} WSREP_SST_OPT_PSWD=${WSREP_SST_OPT_PSWD:-} WSREP_SST_OPT_DEFAULT="" WSREP_SST_OPT_EXTRA_DEFAULT="" +WSREP_SST_OPT_SUFFIX_DEFAULT="" while [ $# -gt 0 ]; do case "$1" in @@ -35,19 +35,22 @@ case "$1" in # # Break address string into host:port/path parts # - if echo $WSREP_SST_OPT_ADDR | grep -qe '^\[.*\]' + readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*} + if [ ${WSREP_SST_OPT_HOST:0:1} = '[' ] then # IPv6 notation - readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR/\]*/\]} - readonly WSREP_SST_OPT_HOST_UNESCAPED=$(echo $WSREP_SST_OPT_HOST | \ - cut -d '[' -f 2 | cut -d ']' -f 1) + readonly WSREP_SST_OPT_HOST_UNESCAPED=${WSREP_SST_OPT_HOST:1:-1} else - # "traditional" notation - readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*} + readonly WSREP_SST_OPT_HOST_UNESCAPED=${WSREP_SST_OPT_HOST} fi readonly WSREP_SST_OPT_PORT=$(echo $WSREP_SST_OPT_ADDR | \ cut -d ']' -f 2 | cut -s -d ':' -f 2 | cut -d '/' -f 1) readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/} + readonly WSREP_SST_OPT_MODULE=${WSREP_SST_OPT_PATH%%/*} + remain=${WSREP_SST_OPT_PATH#*/} + readonly WSREP_SST_OPT_LSN=${remain%%/*} + remain=${remain#*/} + readonly WSREP_SST_OPT_SST_VER=${remain%%/*} shift ;; '--bypass') @@ -66,7 +69,7 @@ case "$1" in shift ;; '--defaults-group-suffix') - WSREP_SST_OPT_CONF_SUFFIX="$2" + readonly WSREP_SST_OPT_SUFFIX_DEFAULT="$1=$2" shift ;; '--host') @@ -122,7 +125,6 @@ shift done readonly WSREP_SST_OPT_BYPASS readonly WSREP_SST_OPT_BINLOG -readonly WSREP_SST_OPT_CONF_SUFFIX # try to use my_print_defaults, mysql and mysqldump that come with the sources # (for MTR suite) @@ -150,19 +152,18 @@ else MY_PRINT_DEFAULTS=$(which my_print_defaults) fi -readonly WSREP_SST_OPT_CONF="$WSREP_SST_OPT_DEFAULT $WSREP_SST_OPT_EXTRA_DEFAULT" -MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF" +readonly WSREP_SST_OPT_CONF="$WSREP_SST_OPT_DEFAULT $WSREP_SST_OPT_EXTRA_DEFAULT $WSREP_SST_OPT_SUFFIX_DEFAULT" +readonly MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF" + wsrep_auth_not_set() { [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ] } -# For Bug:1200727 -if $MY_PRINT_DEFAULTS sst | grep -q "wsrep_sst_auth" -then - if wsrep_auth_not_set - then - WSREP_SST_OPT_AUTH=$($MY_PRINT_DEFAULTS sst | grep -- "--wsrep_sst_auth" | cut -d= -f2) +# State Snapshot Transfer authentication password was displayed in the ps output. Bug fixed #1200727. +if $MY_PRINT_DEFAULTS sst | grep -q "wsrep_sst_auth"; then + if wsrep_auth_not_set; then + WSREP_SST_OPT_AUTH=$($MY_PRINT_DEFAULTS sst | grep -- "--wsrep_sst_auth" | cut -d= -f2) fi fi readonly WSREP_SST_OPT_AUTH @@ -241,7 +242,7 @@ wsrep_check_programs() # process like encryption, etc..... # parse such configuration option. (group for xb settings is [sst] in my.cnf # -# 1st param: group : name of the config file section, e.g. mysqld +# 1st param: group (config file section like sst) or my_print_defaults argument (like --mysqld) # 2nd param: var : name of the variable in the section, e.g. server-id # 3rd param: - : default value for the param parse_cnf() @@ -250,20 +251,11 @@ parse_cnf() local var=$2 local reval="" - # print the default settings for given group using my_print_default. # normalize the variable names specified in cnf file (user can use _ or - for example log-bin or log_bin) - # then grep for needed variable + # then search for needed variable # finally get the variable value (if variables has been specified multiple time use the last value only) - # look in group+suffix - if [ -n $WSREP_SST_OPT_CONF_SUFFIX ]; then - reval=$($MY_PRINT_DEFAULTS "${group}${WSREP_SST_OPT_CONF_SUFFIX}" | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1) - fi - - # look in group - if [ -z $reval ]; then - reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1) - fi + reval=$($MY_PRINT_DEFAULTS "${group}" | awk -v var="${var}" 'BEGIN { OFS=FS="=" } { gsub(/_/,"-",$1); if ( $1=="--"var) lastval=substr($0,length($1)+2) } END { print lastval}') # use default if we haven't found a value if [ -z $reval ]; then diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index f086d9873d05e08f35ea3af8e0a8ec8ac3f1f95e..358247359e6fbadcc789077562344ed552e12974 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -17,10 +17,6 @@ # This is a reference script for mysqldump-based state snapshot tansfer -# This variable is not used in mysqldump sst, so better initialize it -# to avoid shell's "parameter not set" message. -WSREP_SST_OPT_CONF="" - . $(dirname $0)/wsrep_sst_common PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin @@ -57,10 +53,10 @@ then fi # Check client version -if ! $MYSQL_CLIENT --version | grep 'Distrib 10.1' >/dev/null +if ! $MYSQL_CLIENT --version | grep 'Distrib 10\.[1-9]' >/dev/null then $MYSQL_CLIENT --version >&2 - wsrep_log_error "this operation requires MySQL client version 10 or newer" + wsrep_log_error "this operation requires MySQL client version 10.1 or newer" exit $EINVAL fi @@ -118,7 +114,7 @@ $MYSQL_CLIENT $AUTH -S$WSREP_SST_OPT_SOCKET --disable-reconnect --connect_timeou tail -1 | awk -F ' ' '{ print $2 }') MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\ -"$AUTH -h${WSREP_SST_OPT_HOST_UNESCAPED:-$WSREP_SST_OPT_HOST} "\ +"$AUTH -h${WSREP_SST_OPT_HOST_UNESCAPED} "\ "-P$WSREP_SST_OPT_PORT --disable-reconnect --connect_timeout=10" # Check if binary logging is enabled on the joiner node. diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index c6e8a7ef4e1b0d108e7ac54e29ffd470141cb668..3d76d1780e239d1ec98447340a52090d83603e66 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -102,19 +102,7 @@ fi WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} # if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf mariadb-10.0 innodb_log_group_home_dir "") -fi -if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf mysqld innodb_log_group_home_dir "") -fi -if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf server innodb_log_group_home_dir "") -fi -if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf mariadb innodb_log_group_home_dir "") -fi -if [ -z "$WSREP_LOG_DIR" ]; then - WSREP_LOG_DIR=$(parse_cnf mysqld-10.0 innodb_log_group_home_dir "") + WSREP_LOG_DIR=$(parse_cnf --mysqld innodb-log-group-home-dir '') fi if [ -n "$WSREP_LOG_DIR" ]; then diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index 9284bf7801957347d846d71884a9b3490ccb6899..64dd182e2f2f5b3c139e2d0272d05e51f9311772 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -32,9 +32,6 @@ ecode=0 ssyslog="" ssystag="" XTRABACKUP_PID="" -SST_PORT="" -REMOTEIP="" -REMOTEHOST="" tca="" tcert="" tkey="" @@ -42,7 +39,6 @@ sockopt="" progress="" ttime=0 totime=0 -lsn="" ecmd="" rlimit="" # Initially @@ -77,11 +73,6 @@ ssl_cert="" ssl_ca="" ssl_key="" -# Required for backup locks -# For backup locks it is 1 sent by joiner -# 5.6.21 PXC and later can't donate to an older joiner -sst_ver=1 - if which pv &>/dev/null && pv --help | grep -q FORMAT;then pvopts+=$pvformat fi @@ -97,6 +88,13 @@ MAGIC_FILE="${DATA}/${INFO_FILE}" # Setting the path for ss and ip export PATH="/usr/sbin:/sbin:$PATH" +OS=$(uname) + +if ! which lsof > /dev/null; then + wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." + exit 2 # ENOENT +fi + timeit(){ local stage=$1 shift @@ -251,11 +249,7 @@ verify_file_exists() get_transfer() { - if [[ -z $SST_PORT ]];then - TSST_PORT=4444 - else - TSST_PORT=$SST_PORT - fi + TSST_PORT=${WSREP_SST_OPT_PORT:-4444} if [[ $tfmt == 'nc' ]];then if [[ ! -x `which nc` ]];then @@ -280,7 +274,7 @@ get_transfer() fi else # netcat doesn't understand [] around IPv6 address - tcmd="nc ${REMOTEIP//[\[\]]/} ${TSST_PORT}" + tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" fi else tfmt='socat' @@ -342,7 +336,7 @@ get_transfer() tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},cafile=${tca}${joiner_extra}${sockopt} stdio" else wsrep_log_info "Encrypting with CERT: $tcert, CA: $tca" - tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}" + tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}" fi elif [[ $encrypt -eq 3 ]];then wsrep_log_warning "**** WARNING **** encrypt=3 is deprecated and will be removed in a future release" @@ -359,7 +353,7 @@ get_transfer() tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},key=${tkey},verify=0${joiner_extra}${sockopt} stdio" else wsrep_log_info "Encrypting with CERT: $tcert, KEY: $tkey" - tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}" + tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}" fi elif [[ $encrypt -eq 4 ]]; then wsrep_log_info "Using openssl based encryption with socat: with key, crt, and ca" @@ -380,7 +374,7 @@ get_transfer() tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${joiner_extra}${sockopt} stdio" else wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca" - tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}" + tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}" fi else @@ -391,7 +385,7 @@ get_transfer() if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" else - tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" + tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}" fi fi fi @@ -400,7 +394,7 @@ get_transfer() get_footprint() { pushd $WSREP_SST_OPT_DATA 1>/dev/null - payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }') + payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then # QuickLZ has around 50% compression ratio # When compression/compaction used, the progress is only an approximate. @@ -452,7 +446,11 @@ read_cnf() progress=$(parse_cnf sst progress "") rebuild=$(parse_cnf sst rebuild 0) ttime=$(parse_cnf sst time 0) - cpat=$(parse_cnf sst cpat '.*\.pem$\|.*init\.ok$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') + if [ "${OS}" = "FreeBSD" ]; then + cpat=$(parse_cnf sst cpat '.*\.pem$|.*init\.ok$|.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$') + else + cpat=$(parse_cnf sst cpat '.*\.pem$\|.*init\.ok$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') + fi ealgo=$(parse_cnf xtrabackup encrypt "") ekey=$(parse_cnf xtrabackup encrypt-key "") ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") @@ -470,15 +468,15 @@ read_cnf() # Pull the parameters needed for encrypt=4 ssl_ca=$(parse_cnf sst ssl-ca "") if [[ -z "$ssl_ca" ]]; then - ssl_ca=$(parse_cnf mysqld ssl-ca "") + ssl_ca=$(parse_cnf --mysqld ssl-ca "") fi ssl_cert=$(parse_cnf sst ssl-cert "") if [[ -z "$ssl_cert" ]]; then - ssl_cert=$(parse_cnf mysqld ssl-cert "") + ssl_cert=$(parse_cnf --mysqld ssl-cert "") fi ssl_key=$(parse_cnf sst ssl-key "") if [[ -z "$ssl_key" ]]; then - ssl_key=$(parse_cnf mysqld ssl-key "") + ssl_key=$(parse_cnf --mysqld ssl-key "") fi rlimit=$(parse_cnf sst rlimit "") @@ -492,7 +490,7 @@ read_cnf() ssystag+="-" if [[ $ssyslog -ne -1 ]];then - if $MY_PRINT_DEFAULTS mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then + if $MY_PRINT_DEFAULTS mysqld_safe | grep -q -- "--syslog";then ssyslog=1 fi fi @@ -635,18 +633,6 @@ kill_xtrabackup() rm -f "$XTRABACKUP_PID" || true } -setup_ports() -{ - if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then - SST_PORT=$WSREP_SST_OPT_PORT - REMOTEIP=$WSREP_SST_OPT_HOST - lsn=$(echo $WSREP_SST_OPT_PATH | awk -F '[/]' '{ print $2 }') - sst_ver=$(echo $WSREP_SST_OPT_PATH | awk -F '[/]' '{ print $3 }') - else - SST_PORT=$WSREP_SST_OPT_PORT - fi -} - # waits ~1 minute for nc/socat to open the port and then reports ready # (regardless of timeout) wait_for_listen() @@ -654,22 +640,24 @@ wait_for_listen() local HOST=$1 local PORT=$2 local MODULE=$3 + local LSOF_OUT for i in {1..300} do - ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break + LSOF_OUT=$(lsof -sTCP:LISTEN -i TCP:${PORT} -a -c nc -c socat -F c) + [ -n "${LSOF_OUT}" ] && break sleep 0.2 done - echo "ready ${HOST}:${PORT}/${MODULE}//$sst_ver" + echo "ready ${HOST}:${PORT}/${MODULE}//${WSREP_SST_OPT_SST_VER:-1}" } check_extra() { local use_socket=1 if [[ $uextra -eq 1 ]];then - if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then - local eport=$($MY_PRINT_DEFAULTS mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) + if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then + local eport=$(parse_cnf --mysqld extra-port) if [[ -n $eport ]];then # Xtrabackup works only locally. # Hence, setting host to 127.0.0.1 unconditionally. @@ -830,7 +818,6 @@ if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' fi read_cnf -setup_ports if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then disver="--no-version-check" @@ -864,20 +851,24 @@ if [[ $ssyslog -eq 1 ]];then logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@" } - INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply " - INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move " - INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" + INNOAPPLY="2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply " + INNOMOVE="2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move " + INNOBACKUP="2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" fi else - INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" - INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} --defaults-group=mysqld${WSREP_SST_OPT_CONF_SUFFIX} $disver $impts --datadir=${DATA} --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log" - INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_DEFAULT} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log" + INNOAPPLY="&>\${DATA}/innobackup.prepare.log" + INNOMOVE="&>\${DATA}/innobackup.move.log" + INNOBACKUP="2>\${DATA}/innobackup.backup.log" fi get_stream get_transfer +INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} ${INNOAPPLY}" +INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} ${INNOMOVE}" +INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir ${INNOBACKUP}" + if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then trap cleanup_donor EXIT @@ -885,13 +876,13 @@ then if [ $WSREP_SST_OPT_BYPASS -eq 0 ] then usrst=0 - if [[ -z $sst_ver ]];then + if [[ -z $WSREP_SST_OPT_SST_VER ]];then wsrep_log_error "Upgrade joiner to 5.6.21 or higher for backup locks support" wsrep_log_error "The joiner is not supported for this version of donor" exit 93 fi - if [[ -z $(parse_cnf mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then + if [[ -z $(parse_cnf --mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then xtmpdir=$(mktemp -d) tmpopts=" --tmpdir=$xtmpdir " wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory" @@ -948,7 +939,7 @@ then wsrep_log_info "Sleeping before data transfer for SST" sleep 10 - wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT:-4444}" + wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444}" # Add compression to the head of the stream (if specified) if [[ -n $scomp ]]; then @@ -1010,9 +1001,9 @@ then [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" [[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE - ib_home_dir=$(parse_cnf mysqld innodb-data-home-dir "") - ib_log_dir=$(parse_cnf mysqld innodb-log-group-home-dir "") - ib_undo_dir=$(parse_cnf mysqld innodb-undo-directory "") + ib_home_dir=$(parse_cnf --mysqld innodb-data-home-dir "") + ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "") + ib_undo_dir=$(parse_cnf --mysqld innodb-undo-directory "") stagemsg="Joiner-Recv" @@ -1072,9 +1063,13 @@ then wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" - find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ + if [ "${OS}" = "FreeBSD" ]; then + find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ + else + find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ + fi - tempdir=$(parse_cnf mysqld log-bin "") + tempdir=$(parse_cnf --mysqld log-bin "") if [[ -n ${tempdir:-} ]];then binlog_dir=$(dirname $tempdir) binlog_file=$(basename $tempdir) diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index ca3c0129837ce9f279eea726d060f0faf774596a..867aab622ed04a5ee62f93b34627c3aa3744263e 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -30,15 +30,13 @@ encrypt=0 nproc=1 ecode=0 XTRABACKUP_PID="" -SST_PORT="" -REMOTEIP="" tcert="" tpem="" sockopt="" progress="" ttime=0 totime=0 -lsn="" +lsn="${WSREP_SST_OPT_LSN}" incremental=0 ecmd="" rlimit="" @@ -136,11 +134,7 @@ get_keys() get_transfer() { - if [[ -z $SST_PORT ]];then - TSST_PORT=4444 - else - TSST_PORT=$SST_PORT - fi + TSST_PORT=${WSREP_SST_OPT_PORT:-4444} if [[ $tfmt == 'nc' ]];then if [[ ! -x `which nc` ]];then @@ -155,7 +149,7 @@ get_transfer() tcmd="nc -dl ${TSST_PORT}" fi else - tcmd="nc ${REMOTEIP} ${TSST_PORT}" + tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" fi else tfmt='socat' @@ -181,34 +175,23 @@ get_transfer() tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" else wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" - tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" + tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" fi else if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" else - tcmd="socat -u stdio TCP:${REMOTEIP}:${TSST_PORT}${sockopt}" + tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}" fi fi fi } -parse_cnf() -{ - local group=$1 - local var=$2 - reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) - if [[ -z $reval ]];then - [[ -n $3 ]] && reval=$3 - fi - echo $reval -} - get_footprint() { pushd $WSREP_SST_OPT_DATA 1>/dev/null - payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }') + payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then # QuickLZ has around 50% compression ratio # When compression/compaction used, the progress is only an approximate. @@ -354,17 +337,6 @@ kill_xtrabackup() rm -f "$XTRABACKUP_PID" } -setup_ports() -{ - if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then - SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') - REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') - lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') - else - SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') - fi -} - # waits ~10 seconds for nc to open the port and then reports ready # (regardless of timeout) wait_for_listen() @@ -388,8 +360,8 @@ check_extra() { local use_socket=1 if [[ $uextra -eq 1 ]];then - if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then - local eport=$($MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) + if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then + local eport=$(parse_cnf --mysqld extra-port) if [[ -n $eport ]];then # Xtrabackup works only locally. # Hence, setting host to 127.0.0.1 unconditionally. @@ -466,7 +438,7 @@ then check_extra - wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT}" + wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT}" if [[ -n $progress ]];then get_footprint @@ -547,14 +519,9 @@ then # May need xtrabackup_checkpoints later on rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile - ADDR=${WSREP_SST_OPT_ADDR} - if [ -z "${SST_PORT}" ] - then - SST_PORT=4444 - ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" - fi + ADDR="${WSREP_SST_OPT_HOST}:${WSREP_SST_OPT_PORT:-4444}" - wait_for_listen ${SST_PORT} ${ADDR} ${MODULE} & + wait_for_listen ${WSREP_SST_OPT_PORT:-4444} ${ADDR} ${MODULE} & trap sig_joiner_cleanup HUP PIPE INT TERM trap cleanup_joiner EXIT diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index b4acac54124ae7dc73607d32acc5fbf0f8dee155..f6ee59a9237be2d4da1d96f514a2e66965654a75 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2006, 2014, Oracle and/or its affiliates. -# Copyright (c) 2010, 2015, MariaDB +# Copyright (c) 2010, 2018, MariaDB # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/sql/contributors.h b/sql/contributors.h index 88a4a088acf781cdac1af9e024e67bf22e04fa73..7369dcd141d4c3d157a36376b77423fb1c66c60c 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -38,8 +38,9 @@ struct show_table_contributors_st { struct show_table_contributors_st show_table_contributors[]= { /* MariaDB foundation sponsors, in contribution, size , time order */ {"Booking.com", "https://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"}, - {"Alibaba Cloud", "https://intl.aliyun.com", "Platinum Sponsor of the MariaDB Foundation"}, + {"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"}, {"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"}, + {"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"}, {"MariaDB Corporation", "https://mariadb.com", "Founding member, Gold Sponsor of the MariaDB Foundation"}, {"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"}, {"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"}, diff --git a/sql/field.cc b/sql/field.cc index 141a7354433ea1bdbe001424ce783e68b2e891d1..9bc1fcbffe84c2a111e24c7ddac3ed47f212b142 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2138,7 +2138,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy) { uint store_length; copy->str= ptr; - copy->length= pack_length(); + copy->length= pack_length_in_rec(); copy->field= this; if (flags & BLOB_FLAG) { @@ -9422,7 +9422,7 @@ int Field_bit::key_cmp(const uchar *str, uint length) str++; length--; } - return memcmp(ptr, str, length); + return memcmp(ptr, str, bytes_in_rec); } diff --git a/sql/field.h b/sql/field.h index 530f6d083d2648c44ad5ddd1fc126a81ff54fda4..c21bba6936fbffc158627d403923f0b535137ca8 100644 --- a/sql/field.h +++ b/sql/field.h @@ -618,7 +618,7 @@ class Field: public Value_source { return alloc_root(mem_root, size); } static void *operator new(size_t size) throw () { return sql_alloc(size); } - static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); } + static void operator delete(void *ptr_arg, size_t size) { TRASH_FREE(ptr_arg, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { DBUG_ASSERT(0); } diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 850403afb9703b4c86f0e92635ada9692fd8a8bb..c4c843a3bbdac126f9259dc9a2ce127ada2fe5ba 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -607,7 +607,7 @@ void Copy_field::set(uchar *to,Field *from) { from_ptr=from->ptr; to_ptr=to; - from_length=from->pack_length(); + from_length=from->pack_length_in_rec(); if (from->maybe_null()) { from_null_ptr=from->null_ptr; @@ -655,9 +655,9 @@ void Copy_field::set(Field *to,Field *from,bool save) from_field=from; to_field=to; from_ptr=from->ptr; - from_length=from->pack_length(); + from_length=from->pack_length_in_rec(); to_ptr= to->ptr; - to_length=to_field->pack_length(); + to_length=to_field->pack_length_in_rec(); // set up null handling from_null_ptr=to_null_ptr=0; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0649d5d44aa19d979d494f18d5b9dd4532428ea6..34c253cc48aaec4489c1d0c8aefa5539e33f746f 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2180,38 +2180,19 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) DBUG_ASSERT(sub_elem); part= i * num_subparts + j; DBUG_ASSERT(part < m_file_tot_parts && m_file[part]); - if (ha_legacy_type(m_file[part]->ht) == DB_TYPE_INNODB) - { - dummy_info.data_file_name= dummy_info.index_file_name = NULL; - m_file[part]->update_create_info(&dummy_info); - - if (dummy_info.data_file_name || sub_elem->data_file_name) - { - sub_elem->data_file_name = (char*) dummy_info.data_file_name; - } - if (dummy_info.index_file_name || sub_elem->index_file_name) - { - sub_elem->index_file_name = (char*) dummy_info.index_file_name; - } - } + dummy_info.data_file_name= dummy_info.index_file_name = NULL; + m_file[part]->update_create_info(&dummy_info); + sub_elem->data_file_name = (char*) dummy_info.data_file_name; + sub_elem->index_file_name = (char*) dummy_info.index_file_name; } } else { DBUG_ASSERT(m_file[i]); - if (ha_legacy_type(m_file[i]->ht) == DB_TYPE_INNODB) - { - dummy_info.data_file_name= dummy_info.index_file_name= NULL; - m_file[i]->update_create_info(&dummy_info); - if (dummy_info.data_file_name || part_elem->data_file_name) - { - part_elem->data_file_name = (char*) dummy_info.data_file_name; - } - if (dummy_info.index_file_name || part_elem->index_file_name) - { - part_elem->index_file_name = (char*) dummy_info.index_file_name; - } - } + dummy_info.data_file_name= dummy_info.index_file_name= NULL; + m_file[i]->update_create_info(&dummy_info); + part_elem->data_file_name = (char*) dummy_info.data_file_name; + part_elem->index_file_name = (char*) dummy_info.index_file_name; } } DBUG_VOID_RETURN; @@ -8152,20 +8133,36 @@ uint ha_partition::alter_table_flags(uint flags) bool ha_partition::check_if_incompatible_data(HA_CREATE_INFO *create_info, uint table_changes) { - handler **file; - bool ret= COMPATIBLE_DATA_YES; - /* The check for any partitioning related changes have already been done in mysql_alter_table (by fix_partition_func), so it is only up to the underlying handlers. */ - for (file= m_file; *file; file++) - if ((ret= (*file)->check_if_incompatible_data(create_info, - table_changes)) != - COMPATIBLE_DATA_YES) - break; - return ret; + List_iterator part_it(m_part_info->partitions); + HA_CREATE_INFO dummy_info= *create_info; + uint i=0; + while (partition_element *part_elem= part_it++) + { + if (m_is_sub_partitioned) + { + List_iterator subpart_it(part_elem->subpartitions); + while (partition_element *sub_elem= subpart_it++) + { + dummy_info.data_file_name= sub_elem->data_file_name; + dummy_info.index_file_name= sub_elem->index_file_name; + if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes)) + return COMPATIBLE_DATA_NO; + } + } + else + { + dummy_info.data_file_name= part_elem->data_file_name; + dummy_info.index_file_name= part_elem->index_file_name; + if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes)) + return COMPATIBLE_DATA_NO; + } + } + return COMPATIBLE_DATA_YES; } diff --git a/sql/handler.cc b/sql/handler.cc index a5a28ceb77777ba740147abb0d8e083625b7c60c..b2a00e48d659feb19f929e0b525792acae1bc095 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3325,9 +3325,11 @@ void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag) if (key == NULL) { - /* Key is unknown */ - str.copy("", 0, system_charset_info); - my_printf_error(ER_DUP_ENTRY, msg, errflag, str.c_ptr(), "*UNKNOWN*"); + /* + Key is unknown. Should only happen if storage engine reports wrong + duplicate key number. + */ + my_printf_error(ER_DUP_ENTRY, msg, errflag, "", "*UNKNOWN*"); } else { @@ -3421,11 +3423,9 @@ void handler::print_error(int error, myf errflag) if (table) { uint key_nr=get_dup_key(error); - if ((int) key_nr >= 0) + if ((int) key_nr >= 0 && key_nr < table->s->keys) { - print_keydup_error(table, - key_nr == MAX_KEY ? NULL : &table->key_info[key_nr], - errflag); + print_keydup_error(table, &table->key_info[key_nr], errflag); DBUG_VOID_RETURN; } } diff --git a/sql/item.cc b/sql/item.cc index 97bd15b688e133079a369f9427f1559546b5d6cc..2cc45dc60109d9efb8abbfc3520c2d8e228317ad 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB Corporation + Copyright (c) 2010, 2018, 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 @@ -8404,7 +8404,7 @@ Item *Item_default_value::transform(THD *thd, Item_transformer transformer, bool Item_insert_value::eq(const Item *item, bool binary_cmp) const { return item->type() == INSERT_VALUE_ITEM && - ((Item_default_value *)item)->arg->eq(arg, binary_cmp); + ((Item_insert_value *)item)->arg->eq(arg, binary_cmp); } @@ -9923,11 +9923,11 @@ const char *dbug_print_item(Item *item) ulonglong save_option_bits= thd->variables.option_bits; thd->variables.option_bits &= ~OPTION_QUOTE_SHOW_CREATE; - item->print(&str ,QT_EXPLAIN); + item->print(&str, QT_EXPLAIN); thd->variables.option_bits= save_option_bits; - if (str.c_ptr() == buf) + if (str.c_ptr_safe() == buf) return buf; else return "Couldn't fit into buffer"; diff --git a/sql/item.h b/sql/item.h index 921179ce232f690b6461fd64f5066d3aeba6178d..a9b8006cdf3c897ea658b716376591a5a8026552 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2,7 +2,7 @@ #define SQL_ITEM_INCLUDED /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2018, 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 @@ -54,6 +54,12 @@ bool trace_unsupported_by_check_vcol_func_processor(const char *where) return trace_unsupported_func(where, "check_vcol_func_processor"); } +#ifdef DBUG_OFF +static inline const char *dbug_print_item(Item *item) { return NULL; } +#else +extern const char *dbug_print_item(Item *item); +#endif + class Protocol; struct TABLE_LIST; void item_init(void); /* Init item functions */ @@ -623,7 +629,7 @@ class Item: public Value_source, public: static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return alloc_root(mem_root, size); } - static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } + static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} enum Type {FIELD_ITEM= 0, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index c7e957731f7ce1a69170688602c8b6427e28d41c..4e2e5bd4cac6d824f9de94bdab9d952814459cfb 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1232,6 +1232,7 @@ bool Item_in_optimizer::is_top_level_item() void Item_in_optimizer::fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) { + DBUG_ASSERT(fixed); /* This will re-calculate attributes of our Item_in_subselect: */ Item_bool_func::fix_after_pullout(new_parent, ref, merge); @@ -1255,6 +1256,33 @@ bool Item_in_optimizer::eval_not_null_tables(uchar *opt_arg) } +void Item_in_optimizer::print(String *str, enum_query_type query_type) +{ + restore_first_argument(); + Item_func::print(str, query_type); +} + + +/** + "Restore" first argument before fix_fields() call (after it is harmless). + + @Note: Main pointer to left part of IN/ALL/ANY subselect is subselect's + lest_expr (see Item_in_optimizer::fix_left) so changes made during + fix_fields will be rolled back there which can make + Item_in_optimizer::args[0] unusable on second execution before fix_left() + call. This call fix the pointer. +*/ + +void Item_in_optimizer::restore_first_argument() +{ + if (args[1]->type() == Item::SUBSELECT_ITEM && + ((Item_subselect *)args[1])->is_in_predicate()) + { + args[0]= ((Item_in_subselect *)args[1])->left_expr; + } +} + + bool Item_in_optimizer::fix_left(THD *thd) { DBUG_ENTER("Item_in_optimizer::fix_left"); @@ -1429,6 +1457,7 @@ bool Item_in_optimizer::invisible_mode() Item *Item_in_optimizer::expr_cache_insert_transformer(THD *thd, uchar *unused) { DBUG_ENTER("Item_in_optimizer::expr_cache_insert_transformer"); + DBUG_ASSERT(fixed); if (invisible_mode()) DBUG_RETURN(this); @@ -1453,6 +1482,7 @@ Item *Item_in_optimizer::expr_cache_insert_transformer(THD *thd, uchar *unused) void Item_in_optimizer::get_cache_parameters(List ¶meters) { + DBUG_ASSERT(fixed); /* Add left expression to the list of the parameters of the subquery */ if (!invisible_mode()) { @@ -1690,6 +1720,7 @@ Item *Item_in_optimizer::transform(THD *thd, Item_transformer transformer, { Item *new_item; + DBUG_ASSERT(fixed); DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare()); DBUG_ASSERT(arg_count == 2); @@ -1741,6 +1772,7 @@ Item *Item_in_optimizer::transform(THD *thd, Item_transformer transformer, bool Item_in_optimizer::is_expensive_processor(uchar *arg) { + DBUG_ASSERT(fixed); return args[0]->is_expensive_processor(arg) || args[1]->is_expensive_processor(arg); } @@ -1748,6 +1780,7 @@ bool Item_in_optimizer::is_expensive_processor(uchar *arg) bool Item_in_optimizer::is_expensive() { + DBUG_ASSERT(fixed); return args[0]->is_expensive() || args[1]->is_expensive(); } @@ -2793,7 +2826,9 @@ void Item_func_nullif::print(String *str, enum_query_type query_type) Therefore, after equal field propagation args[0] and args[2] can point to different items. */ - if ((query_type & QT_ITEM_ORIGINAL_FUNC_NULLIF) || args[0] == args[2]) + if ((query_type & QT_ITEM_ORIGINAL_FUNC_NULLIF) || + (arg_count == 2) || + (args[0] == args[2])) { /* If QT_ITEM_ORIGINAL_FUNC_NULLIF is requested, @@ -2811,10 +2846,14 @@ void Item_func_nullif::print(String *str, enum_query_type query_type) - one "a" for comparison - another "a" for the returned value! */ - DBUG_ASSERT(args[0] == args[2] || current_thd->lex->context_analysis_only); + DBUG_ASSERT(arg_count == 2 || + args[0] == args[2] || current_thd->lex->context_analysis_only); str->append(func_name()); str->append('('); - args[2]->print(str, query_type); + if (arg_count == 2) + args[0]->print(str, query_type); + else + args[2]->print(str, query_type); str->append(','); args[1]->print(str, query_type); str->append(')'); diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 361e4b3558f320d35f2bf64ac0b43b1ccef456bf..076e6da953cb08bf0d2406f1e7e7aa514eb859c2 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -345,6 +345,8 @@ class Item_in_optimizer: public Item_bool_func void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); bool invisible_mode(); void reset_cache() { cache= NULL; } + virtual void print(String *str, enum_query_type query_type); + void restore_first_argument(); }; @@ -1677,9 +1679,9 @@ class Item_func_isnull :public Item_func_null_predicate bool arg_is_datetime_notnull_field() { Item **args= arguments(); - if (args[0]->type() == Item::FIELD_ITEM) + if (args[0]->real_item()->type() == Item::FIELD_ITEM) { - Field *field=((Item_field*) args[0])->field; + Field *field=((Item_field*) args[0]->real_item())->field; if (((field->type() == MYSQL_TYPE_DATE) || (field->type() == MYSQL_TYPE_DATETIME)) && diff --git a/sql/item_func.cc b/sql/item_func.cc index 6b444a7e86d7324a63a835a59c3272711b533412..0700d71a396e2b43e366b29d30850217cba0e572 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -550,6 +550,7 @@ my_decimal *Item_real_func::val_decimal(my_decimal *decimal_value) } +#ifdef HAVE_DLOPEN void Item_udf_func::fix_num_length_and_dec() { uint fl_length= 0; @@ -566,6 +567,7 @@ void Item_udf_func::fix_num_length_and_dec() max_length= float_length(NOT_FIXED_DEC); } } +#endif /** diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 04927f88b775aa9c9915d3ce8d734dc6f2ea9cc2..cd47257a77b0945ca956fa4d33f9a408a57eff0d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2018, 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 @@ -203,9 +203,9 @@ String *Item_func_sha2::val_str_ascii(String *str) const char *input_ptr; size_t input_len; + input_string= args[0]->val_str(str); str->set_charset(&my_charset_bin); - input_string= args[0]->val_str(str); if (input_string == NULL) { null_value= TRUE; @@ -546,139 +546,84 @@ String *Item_func_decode_histogram::val_str(String *str) /////////////////////////////////////////////////////////////////////////////// +/* + Realloc the result buffer. + NOTE: We should be prudent in the initial allocation unit -- the + size of the arguments is a function of data distribution, which + can be any. Instead of overcommitting at the first row, we grow + the allocated amount by the factor of 2. This ensures that no + more than 25% of memory will be overcommitted on average. + + @param IN/OUT str - the result string + @param IN length - new total space required in "str" + @retval false - on success + @retval true - on error +*/ + +bool Item_func_concat::realloc_result(String *str, uint length) const +{ + if (str->alloced_length() >= length) + return false; // Alloced space is big enough, nothing to do. + + if (str->alloced_length() == 0) + return str->alloc(length); + + /* + Item_func_concat::val_str() makes sure the result length does not grow + higher than max_allowed_packet. So "length" is limited to 1G here. + We can't say anything about the current value of str->alloced_length(), + as str was initially set by args[0]->val_str(str). + So multiplication by 2 can overflow, if args[0] for some reasons + did not limit the result to max_alloced_packet. But it's not harmful, + "str" will be realloced exactly to "length" bytes in case of overflow. + */ + uint new_length= MY_MAX(str->alloced_length() * 2, length); + return str->realloc(new_length); +} + + /** Concatenate args with the following premises: If only one arg (which is ok), return value of arg; - Don't reallocate val_str() if not absolute necessary. */ String *Item_func_concat::val_str(String *str) { DBUG_ASSERT(fixed == 1); - String *res,*res2,*use_as_buff; - uint i; - bool is_const= 0; + THD *thd= current_thd; + String *res; null_value=0; - if (!(res=args[0]->val_str(str))) + if (!(res= args[0]->val_str(str))) goto null; - use_as_buff= &tmp_value; - is_const= args[0]->const_item(); - for (i=1 ; i < arg_count ; i++) - { - if (res->length() == 0) - { - if (!(res=args[i]->val_str(str))) - goto null; - /* - CONCAT accumulates its result in the result of its the first - non-empty argument. Because of this we need is_const to be - evaluated only for it. - */ - is_const= args[i]->const_item(); - } - else - { - if (!(res2=args[i]->val_str(use_as_buff))) - goto null; - if (res2->length() == 0) - continue; - if (res->length()+res2->length() > - current_thd->variables.max_allowed_packet) - { - THD *thd= current_thd; - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WARN_ALLOWED_PACKET_OVERFLOWED, - ER_THD(thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED), - func_name(), - thd->variables.max_allowed_packet); - goto null; - } - if (!is_const && res->alloced_length() >= res->length()+res2->length()) - { // Use old buffer - res->append(*res2); - } - else if (str->alloced_length() >= res->length()+res2->length()) - { - if (str->ptr() == res2->ptr()) - str->replace(0,0,*res); - else - { - str->copy(*res); - str->append(*res2); - } - res= str; - use_as_buff= &tmp_value; - } - else if (res == &tmp_value) - { - if (res->append(*res2)) // Must be a blob - goto null; - } - else if (res2 == &tmp_value) - { // This can happend only 1 time - if (tmp_value.replace(0,0,*res)) - goto null; - res= &tmp_value; - use_as_buff=str; // Put next arg here - } - else if (tmp_value.is_alloced() && res2->ptr() >= tmp_value.ptr() && - res2->ptr() <= tmp_value.ptr() + tmp_value.alloced_length()) - { - /* - This happens really seldom: - In this case res2 is sub string of tmp_value. We will - now work in place in tmp_value to set it to res | res2 - */ - /* Chop the last characters in tmp_value that isn't in res2 */ - tmp_value.length((uint32) (res2->ptr() - tmp_value.ptr()) + - res2->length()); - /* Place res2 at start of tmp_value, remove chars before res2 */ - if (tmp_value.replace(0,(uint32) (res2->ptr() - tmp_value.ptr()), - *res)) - goto null; - res= &tmp_value; - use_as_buff=str; // Put next arg here - } - else - { // Two big const strings - /* - NOTE: We should be prudent in the initial allocation unit -- the - size of the arguments is a function of data distribution, which - can be any. Instead of overcommitting at the first row, we grow - the allocated amount by the factor of 2. This ensures that no - more than 25% of memory will be overcommitted on average. - */ - - uint concat_len= res->length() + res2->length(); - - if (tmp_value.alloced_length() < concat_len) - { - if (tmp_value.alloced_length() == 0) - { - if (tmp_value.alloc(concat_len)) - goto null; - } - else - { - uint new_len = MY_MAX(tmp_value.alloced_length() * 2, concat_len); - if (tmp_value.realloc(new_len)) - goto null; - } - } + if (res != str) + str->copy(res->ptr(), res->length(), res->charset()); - if (tmp_value.copy(*res) || tmp_value.append(*res2)) - goto null; - - res= &tmp_value; - use_as_buff=str; - } - is_const= 0; + for (uint i= 1 ; i < arg_count ; i++) + { + uint concat_len; + if (!(res= args[i]->val_str(&tmp_value))) + goto null; + if (res->length() == 0) + continue; + if ((concat_len= str->length() + res->length()) > + thd->variables.max_allowed_packet) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_WARN_ALLOWED_PACKET_OVERFLOWED, + ER(ER_WARN_ALLOWED_PACKET_OVERFLOWED), func_name(), + thd->variables.max_allowed_packet); + goto null; } + DBUG_ASSERT(!res->uses_buffer_owned_by(str)); + DBUG_ASSERT(!str->uses_buffer_owned_by(res)); + if (realloc_result(str, concat_len) || str->append(*res)) + goto null; } - res->set_charset(collation.collation); - return res; + + str->set_charset(collation.collation); + return str; null: null_value=1; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 467e2bd530b0c215f403f0d74a5f82abd24c86cd..e19efd312295ba4b0cae2efecc0184f2daf0b3e4 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -230,6 +230,7 @@ class Item_func_aes_decrypt :public Item_aes_crypt class Item_func_concat :public Item_str_func { String tmp_value; + bool realloc_result(String *str, uint length) const; public: Item_func_concat(THD *thd, List &list): Item_str_func(thd, list) {} Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 1c1f09c45676abce04e6e89c57298950f641e598..7dbaf313ad9359252ebdad41d18c31f17cecb67b 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2128,7 +2128,10 @@ Item_in_subselect::create_single_in_to_exists_cond(JOIN *join, } else { - Item *item= (Item*) select_lex->item_list.head()->real_item(); + Item *item= (Item*) select_lex->item_list.head(); + if (item->type() != REF_ITEM || + ((Item_ref*)item)->ref_type() != Item_ref::VIEW_REF) + item= item->real_item(); if (select_lex->table_list.elements) { @@ -5487,7 +5490,7 @@ int subselect_hash_sj_engine::exec() if (has_covering_null_row) { - DBUG_ASSERT(count_partial_match_columns = field_count); + DBUG_ASSERT(count_partial_match_columns == field_count); count_pm_keys= 0; } else if (has_covering_null_columns) diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 0741da155ac4c15257fa47436aa98d217dc19a9c..c9e6df52de987857626be6eab6866b5ac50a4ad6 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -2702,7 +2702,7 @@ void Item_xml_str_func::fix_length_and_dec() bool Item_xml_str_func::fix_fields(THD *thd, Item **ref) { - String *xp, tmp; + String *xp; MY_XPATH xpath; int rc; @@ -2730,7 +2730,13 @@ bool Item_xml_str_func::fix_fields(THD *thd, Item **ref) return true; } - if (!(xp= args[1]->val_str(&tmp))) + /* + Get the XPath query text from args[1] and cache it in m_xpath_query. + Its fragments will be referenced by items created during my_xpath_parse(), + e.g. by Item_nodeset_func_axisbyname::node_name. + */ + if (!(xp= args[1]->val_str(&m_xpath_query)) || + (xp != &m_xpath_query && m_xpath_query.copy(*xp))) return false; // Will return NULL my_xpath_init(&xpath); xpath.thd= thd; diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index 3758025fc90bf24fc3359e13d396a090eca3c5a4..92a8f7578224096c75573aec5c63605ab2fb8123 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -67,6 +67,7 @@ class Item_xml_str_func: public Item_str_func return parse(res, cache); } }; + String m_xpath_query; // XPath query text Item *nodeset_func; XML xml; bool get_xml(XML *xml_arg, bool cache= false) diff --git a/sql/key.cc b/sql/key.cc index 1b00e951de0ddafc7d9fcbd86a3dea0fc11c42ae..523ddf98640fc9407a735f5c7717696d68818188 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -65,7 +65,8 @@ int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, i < (int) key_count ; i++, key_info++) { - if (key_info->key_part[0].offset == fieldpos) + if (key_info->key_part[0].offset == fieldpos && + key_info->key_part[0].field->type() != MYSQL_TYPE_BIT) { /* Found key. Calc keylength */ *key_length= *keypart= 0; return i; /* Use this key */ @@ -84,7 +85,8 @@ int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field, j < key_info->user_defined_key_parts ; j++, key_part++) { - if (key_part->offset == fieldpos) + if (key_part->offset == fieldpos && + key_part->field->type() != MYSQL_TYPE_BIT) { *keypart= j; return i; /* Use this key */ diff --git a/sql/log.cc b/sql/log.cc index 07d4074c3d4792c2033ec4780efa107d18b7aefa..29f8c5639cfcfcbe0010082f647e6dbcb20d65b0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -4947,7 +4947,55 @@ MYSQL_BIN_LOG::is_xidlist_idle_nolock() return true; } +#ifdef WITH_WSREP +inline bool +is_gtid_cached_internal(IO_CACHE *file) +{ + uchar data[EVENT_TYPE_OFFSET+1]; + bool result= false; + my_off_t write_pos= my_b_tell(file); + if (reinit_io_cache(file, READ_CACHE, 0, 0, 0)) + return false; + /* + In the cache we have gtid event if , below condition is true, + */ + my_b_read(file, data, sizeof(data)); + uint event_type= (uchar)data[EVENT_TYPE_OFFSET]; + if (event_type == GTID_LOG_EVENT) + result= true; + /* + Cleanup , Why because we have not read the full buffer + and this will cause next to next reinit_io_cache(called in write_cache) + to make cache empty. + */ + file->read_pos= file->read_end; + if (reinit_io_cache(file, WRITE_CACHE, write_pos, 0, 0)) + return false; + return result; +} +#endif +#ifdef WITH_WSREP +inline bool +MYSQL_BIN_LOG::is_gtid_cached(THD *thd) +{ + binlog_cache_mngr *mngr= (binlog_cache_mngr *) thd_get_ha_data( + thd, binlog_hton); + if (!mngr) + return false; + binlog_cache_data *cache_trans= mngr->get_binlog_cache_data( + use_trans_cache(thd, true)); + binlog_cache_data *cache_stmt= mngr->get_binlog_cache_data( + use_trans_cache(thd, false)); + if (cache_trans && !cache_trans->empty() && + is_gtid_cached_internal(&cache_trans->cache_log)) + return true; + if (cache_stmt && !cache_stmt->empty() && + is_gtid_cached_internal(&cache_stmt->cache_log)) + return true; + return false; +} +#endif /** Create a new log file name. @@ -5544,7 +5592,37 @@ THD::binlog_start_trans_and_stmt() cache_mngr->trx_cache.get_prev_position() == MY_OFF_T_UNDEF) { this->binlog_set_stmt_begin(); - if (in_multi_stmt_transaction_mode()) + bool mstmt_mode= in_multi_stmt_transaction_mode(); +#ifdef WITH_WSREP + /* Write Gtid + Get domain id only when gtid mode is set + If this event is replicate through a master then , + we will forward the same gtid another nodes + We have to do this only one time in mysql transaction. + Since this function is called multiple times , We will check for + ha_info->is_started() + */ + Ha_trx_info *ha_info; + ha_info= this->ha_data[binlog_hton->slot].ha_info + (mstmt_mode ? 1 : 0); + + if (!ha_info->is_started() && wsrep_gtid_mode + && this->variables.gtid_seq_no) + { + binlog_cache_mngr *const cache_mngr= + (binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton); + + IO_CACHE *file= + cache_mngr->get_binlog_cache_log(use_trans_cache(this, true)); + Log_event_writer writer(file); + Gtid_log_event gtid_event(this, this->variables.gtid_seq_no, + this->variables.gtid_domain_id, + true, LOG_EVENT_SUPPRESS_USE_F, + true, 0); + gtid_event.server_id= this->variables.server_id; + writer.write(>id_event); + } +#endif + if (mstmt_mode) trans_register_ha(this, TRUE, binlog_hton); trans_register_ha(this, FALSE, binlog_hton); /* @@ -5826,7 +5904,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone, DBUG_PRINT("enter", ("standalone: %d", standalone)); #ifdef WITH_WSREP - if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode) + if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode && !thd->variables.gtid_seq_no) { domain_id= wsrep_gtid_domain_id; } else { @@ -5878,6 +5956,12 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone, /* Write the event to the binary log. */ DBUG_ASSERT(this == &mysql_bin_log); + +#ifdef WITH_WSREP + if (wsrep_gtid_mode && is_gtid_cached(thd)) + DBUG_RETURN(false); +#endif + if (write_event(>id_event)) DBUG_RETURN(true); status_var_add(thd->status_var.binlog_bytes_written, gtid_event.data_written); diff --git a/sql/log.h b/sql/log.h index 3026ca11e3101dfe12f97ffc80d0eb69faaaf0a7..2118bd7a05960f3df38f07897d8e910c5d9f8bdf 100644 --- a/sql/log.h +++ b/sql/log.h @@ -559,7 +559,13 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG bool write_transaction_to_binlog_events(group_commit_entry *entry); void trx_group_commit_leader(group_commit_entry *leader); bool is_xidlist_idle_nolock(); - +#ifdef WITH_WSREP + /* + When this mariadb node is slave and galera enabled. So in this case + we write the gtid in wsrep_run_commit itself. + */ + inline bool is_gtid_cached(THD *thd); +#endif public: /* A list of struct xid_count_per_binlog is used to keep track of how many diff --git a/sql/log_event.cc b/sql/log_event.cc index f2f7b8776718c6e0cc14016661ac8b2a59bc1d9f..81bc683625fe4c6ecaef608225a86e39e171dffa 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4184,8 +4184,13 @@ bool test_if_equal_repl_errors(int expected_error, int actual_error) return 1; switch (expected_error) { case ER_DUP_ENTRY: + case ER_DUP_ENTRY_WITH_KEY_NAME: + case ER_DUP_KEY: case ER_AUTOINC_READ_FAILED: - return (actual_error == ER_AUTOINC_READ_FAILED || + return (actual_error == ER_DUP_ENTRY || + actual_error == ER_DUP_ENTRY_WITH_KEY_NAME || + actual_error == ER_DUP_KEY || + actual_error == ER_AUTOINC_READ_FAILED || actual_error == HA_ERR_AUTOINC_ERANGE); case ER_UNKNOWN_TABLE: return actual_error == ER_IT_IS_A_VIEW; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 227c3eb6f991d6dde1948236e5b6e6458c4e716d..0de9d7a9f0b377e6c33b47e9e411351ec3b021c5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4096,7 +4096,7 @@ static int init_common_variables() /* TODO: remove this when my_time_t is 64 bit compatible */ if (!IS_TIME_T_VALID_FOR_TIMESTAMP(server_start_time)) { - sql_print_error("This MySQL server doesn't support dates later then 2038"); + sql_print_error("This MySQL server doesn't support dates later than 2038"); return 1; } diff --git a/sql/net_serv.cc b/sql/net_serv.cc index ed283863d315b73e3e3f23debb89d87a4bd0793e..6d200f55655bbdbade01c02ca99ecec2d18f896a 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -58,9 +58,11 @@ #ifdef EXTRA_DEBUG #define EXTRA_DEBUG_fprintf fprintf #define EXTRA_DEBUG_fflush fflush +#define EXTRA_DEBUG_ASSERT DBUG_ASSERT #else static void inline EXTRA_DEBUG_fprintf(...) {} static int inline EXTRA_DEBUG_fflush(...) { return 0; } +#define EXTRA_DEBUG_ASSERT(X) do {} while(0) #endif #ifdef MYSQL_SERVER #define MYSQL_SERVER_my_error my_error @@ -1072,7 +1074,7 @@ my_real_read(NET *net, size_t *complen, ("Packets out of order (Found: %d, expected %u)", (int) net->buff[net->where_b + 3], net->pkt_nr)); - DBUG_ASSERT(0); + EXTRA_DEBUG_ASSERT(0); /* We don't make noise server side, since the client is expected to break the protocol for e.g. --send LOAD DATA .. LOCAL where diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 5377e4e4aea32187be3da7f14b79f9dda263dd7c..0315b91b8be653f5677122c36b06c7eabb08690e 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2081,7 +2081,7 @@ class TABLE_READ_PLAN /* Table read plans are allocated on MEM_ROOT and are never deleted */ static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } - static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } + static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* Never called */ } virtual ~TABLE_READ_PLAN() {} /* Remove gcc warning */ diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 138af3f14b33fb096d551bf53a173dabaf412bad..d7371fa7e3f239834ddfead3ac289d4406901a7c 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -2704,7 +2704,8 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, LooseScan detector in best_access_path) */ remaining_tables &= ~new_join_tab->table->map; - table_map dups_producing_tables; + table_map dups_producing_tables, prev_dups_producing_tables, + prev_sjm_lookup_tables; if (idx == join->const_tables) dups_producing_tables= 0; @@ -2715,7 +2716,7 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, if ((emb_sj_nest= new_join_tab->emb_sj_nest)) dups_producing_tables |= emb_sj_nest->sj_inner_tables; - Semi_join_strategy_picker **strategy; + Semi_join_strategy_picker **strategy, **prev_strategy; if (idx == join->const_tables) { /* First table, initialize pickers */ @@ -2767,23 +2768,54 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx, 3. We have no clue what to do about fanount of semi-join Y. */ if ((dups_producing_tables & handled_fanout) || - (read_time < *current_read_time && + (read_time < *current_read_time && !(handled_fanout & pos->inner_tables_handled_with_other_sjs))) { - /* Mark strategy as used */ - (*strategy)->mark_used(); - pos->sj_strategy= sj_strategy; - if (sj_strategy == SJ_OPT_MATERIALIZE) - join->sjm_lookup_tables |= handled_fanout; + DBUG_ASSERT(pos->sj_strategy != sj_strategy); + /* + If the strategy choosen first time or + the strategy replace strategy which was used to exectly the same + tables + */ + if (pos->sj_strategy == SJ_OPT_NONE || + handled_fanout == + (prev_dups_producing_tables ^ dups_producing_tables)) + { + prev_strategy= strategy; + if (pos->sj_strategy == SJ_OPT_NONE) + { + prev_dups_producing_tables= dups_producing_tables; + prev_sjm_lookup_tables= join->sjm_lookup_tables; + } + /* Mark strategy as used */ + (*strategy)->mark_used(); + pos->sj_strategy= sj_strategy; + if (sj_strategy == SJ_OPT_MATERIALIZE) + join->sjm_lookup_tables |= handled_fanout; + else + join->sjm_lookup_tables &= ~handled_fanout; + *current_read_time= read_time; + *current_record_count= rec_count; + dups_producing_tables &= ~handled_fanout; + //TODO: update bitmap of semi-joins that were handled together with + // others. + if (is_multiple_semi_joins(join, join->positions, idx, + handled_fanout)) + pos->inner_tables_handled_with_other_sjs |= handled_fanout; + } else - join->sjm_lookup_tables &= ~handled_fanout; - *current_read_time= read_time; - *current_record_count= rec_count; - dups_producing_tables &= ~handled_fanout; - //TODO: update bitmap of semi-joins that were handled together with - // others. - if (is_multiple_semi_joins(join, join->positions, idx, handled_fanout)) - pos->inner_tables_handled_with_other_sjs |= handled_fanout; + { + /* Conflict fall to most general variant */ + (*prev_strategy)->set_empty(); + dups_producing_tables= prev_dups_producing_tables; + join->sjm_lookup_tables= prev_sjm_lookup_tables; + // mark it 'none' to avpoid loops + pos->sj_strategy= SJ_OPT_NONE; + // next skip to last; + strategy= pickers + + (sizeof(pickers)/sizeof(Semi_join_strategy_picker*) - 3); + continue; + } } else { diff --git a/sql/sp.cc b/sql/sp.cc index 5a64c28865e429166fb6018238affe0fd63458db..2e268e483e74e77187b54d57bf1f03e23c0f4764 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -760,7 +760,6 @@ static sp_head *sp_compile(THD *thd, String *defstr, ulonglong sql_mode, else { sp= thd->lex->sphead; - sp->set_select_number(thd->select_number); } thd->pop_internal_handler(); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index eceebd1d13fc0f5ccfb10dcba266759c1b5bdb1c..8bf78d97670e6d6c56d31d4b8a3a18add6a88148 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -597,7 +597,7 @@ sp_head::sp_head() m_flags(0), m_sp_cache_version(0), m_creation_ctx(0), - unsafe_flags(0), m_select_number(1), + unsafe_flags(0), m_recursion_level(0), m_next_cached_sp(0), m_cont_level(0) @@ -840,7 +840,7 @@ sp_head::~sp_head() thd->lex->sphead= NULL; lex_end(thd->lex); delete thd->lex; - thd->lex= lex; + thd->lex= thd->stmt_lex= lex; } my_hash_free(&m_sptabs); @@ -1121,7 +1121,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) backup_arena; query_id_t old_query_id; TABLE *old_derived_tables; - LEX *old_lex; + LEX *old_lex, *old_stmt_lex; Item_change_list old_change_list; String old_packet; uint old_server_status; @@ -1136,19 +1136,6 @@ sp_head::execute(THD *thd, bool merge_da_on_success) if (check_stack_overrun(thd, 7 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); - /* - Normally the counter is not reset between parsing and first execution, - but it is possible in case of error to have parsing on one CALL and - first execution (where VIEW will be parsed and added). So we store the - counter after parsing and restore it before execution just to avoid - repeating SELECT numbers. - - Other problem is that it can be more SELECTs parsed in case of fixing - error causes previous interruption of the SP. So it is save not just - assign old value but add it. - */ - thd->select_number+= m_select_number; - /* init per-instruction memroot */ init_sql_alloc(&execute_mem_root, MEM_ROOT_BLOCK_SIZE, 0, MYF(0)); @@ -1237,6 +1224,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) do it in each instruction */ old_lex= thd->lex; + old_stmt_lex= thd->stmt_lex; /* We should also save Item tree change list to avoid rollback something too early in the calling query. @@ -1384,6 +1372,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) DBUG_ASSERT(thd->change_list.is_empty()); old_change_list.move_elements_to(&thd->change_list); thd->lex= old_lex; + thd->stmt_lex= old_stmt_lex; thd->set_query_id(old_query_id); DBUG_ASSERT(!thd->derived_tables); thd->derived_tables= old_derived_tables; @@ -1482,16 +1471,6 @@ sp_head::execute(THD *thd, bool merge_da_on_success) m_recursion_level + 1)); m_first_instance->m_first_free_instance= this; - /* - This execution of the SP was aborted with an error (e.g. "Table not - found"). However it might still have consumed some numbers from the - thd->select_number counter. The next sp->exec() call must not use the - consumed numbers, so we remember the first free number (We know that - nobody will use it as this execution has stopped with an error). - */ - if (err_status) - set_select_number(thd->select_number); - DBUG_RETURN(err_status); } @@ -2228,7 +2207,7 @@ sp_head::reset_lex(THD *thd) if (sublex == 0) DBUG_RETURN(TRUE); - thd->lex= sublex; + thd->lex= thd->stmt_lex= sublex; (void)m_lex.push_front(oldlex); /* Reset most stuff. */ @@ -2974,7 +2953,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp, We should not save old value since it is saved/restored in sp_head::execute() when we are entering/leaving routine. */ - thd->lex= m_lex; + thd->lex= thd->stmt_lex= m_lex; thd->set_query_id(next_query_id()); diff --git a/sql/sp_head.h b/sql/sp_head.h index 5d3697daa169c7bb340e746678bd59994350f5b6..604190079cbee90710a2df98a1356f308789610f 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -232,7 +232,6 @@ class sp_head :private Query_arena */ uint32 unsafe_flags; - uint m_select_number; public: inline Stored_program_creation_ctx *get_creation_ctx() { @@ -522,8 +521,6 @@ class sp_head :private Query_arena sp_pcontext *get_parse_context() { return m_pcont; } - void set_select_number(uint num) { m_select_number= num; } - private: MEM_ROOT *m_thd_root; ///< Temp. store for thd's mem_root diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 503b65f2be01dda95ba7f931cfccc38451746bec..07b0715dc84a0c17ec1c924e75307842e6b086c1 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5672,6 +5672,8 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)), if (--grantee->counter) return 1; // don't recurse into grantee just yet + grantee->counter= 1; // Mark the grantee as merged. + /* if we'll do db/table/routine privileges, create a hash of role names */ role_hash_t role_hash(role_key); if (data->what != PRIVS_TO_MERGE::GLOBAL) @@ -6761,14 +6763,16 @@ static bool grant_load(THD *thd, TABLE_LIST *tables) DBUG_RETURN(return_val); } -static my_bool collect_leaf_roles(void *role_ptr, - void *roles_array) +static my_bool propagate_role_grants_action(void *role_ptr, + void *ptr __attribute__((unused))) { ACL_ROLE *role= static_cast(role_ptr); - Dynamic_array *array= - static_cast *>(roles_array); - if (!role->counter) - array->push(role); + if (role->counter) + return 0; + + mysql_mutex_assert_owner(&acl_cache->lock); + PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; + traverse_role_graph_up(role, &data, NULL, merge_role_privileges); return 0; } @@ -6835,15 +6839,7 @@ bool grant_reload(THD *thd) } mysql_mutex_lock(&acl_cache->lock); - Dynamic_array leaf_roles; - my_hash_iterate(&acl_roles, collect_leaf_roles, &leaf_roles); - PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 }; - for (size_t i= 0; i < leaf_roles.elements(); i++) - { - traverse_role_graph_up(leaf_roles.at(i), &data, NULL, - merge_role_privileges); - } - + my_hash_iterate(&acl_roles, propagate_role_grants_action, NULL); mysql_mutex_unlock(&acl_cache->lock); mysql_rwlock_unlock(&LOCK_grant); diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 0888f012ddade716dfcff37ca7dbd118e0c9eb64..98584ec4630aa2229f85a1388b8c9e00e7bd1c11 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -663,8 +663,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, if (lock_type == TL_WRITE && !table->table->s->tmp_table && table->mdl_request.type > MDL_SHARED_WRITE) { - if (wait_while_table_is_used(thd, table->table, - HA_EXTRA_PREPARE_FOR_RENAME)) + if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) goto err; DEBUG_SYNC(thd, "after_admin_flush"); /* Flush entries in the query cache involving this table. */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d3d33e04d002c5d4ae4a04fcf866ebeb659df143..01f40bb22470e7d08cf6ba273d966ccd951a95e4 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -9215,7 +9215,16 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order) DBUG_PRINT("info",("Performing FULLTEXT search")); while ((ifm=li++)) - ifm->init_search(thd, no_order); +#if MYSQL_VERSION_ID < 100213 + if (unlikely(!ifm->fixed)) + /* + it mean that clause where was FT function was removed, so we have + to remove the function from the list. + */ + li.remove(); + else +#endif + ifm->init_search(thd, no_order); } return 0; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 66ac2449519a108d07b20d6ba5dd68e8ededf9bf..df6c7c35e5a85bd9ef86f4767231cc3fefa242ad 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1187,7 +1187,11 @@ void Query_cache::end_of_result(THD *thd) #endif if (try_lock(thd, Query_cache::WAIT)) + { + if (is_disabled()) + query_cache_tls->first_query_block= NULL; // do not try again with QC DBUG_VOID_RETURN; + } query_block= query_cache_tls->first_query_block; if (query_block) @@ -1552,6 +1556,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", unlock(); + DEBUG_SYNC(thd, "wait_in_query_cache_store_query"); + // init_n_lock make query block locked BLOCK_UNLOCK_WR(query_block); } @@ -1788,7 +1794,7 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length) sql++; continue; } - /* fall trough */ + /* fall through */ default: break; } @@ -2541,6 +2547,7 @@ void Query_cache::init() */ if (global_system_variables.query_cache_type == 0) { + m_cache_status= DISABLE_REQUEST; free_cache(); m_cache_status= DISABLED; } @@ -2749,13 +2756,17 @@ void Query_cache::make_disabled() This function frees all resources allocated by the cache. You have to call init_cache() before using the cache again. This function - requires the structure_guard_mutex to be locked. + requires the cache to be locked (LOCKED_NO_WAIT, lock_and_suspend) or + disabling. */ void Query_cache::free_cache() { DBUG_ENTER("Query_cache::free_cache"); + DBUG_ASSERT(m_cache_lock_status == LOCKED_NO_WAIT || + m_cache_status == DISABLE_REQUEST); + /* Destroy locks */ Query_cache_block *block= queries_blocks; if (block) @@ -2763,6 +2774,13 @@ void Query_cache::free_cache() do { Query_cache_query *query= block->query(); + /* + There will not be new requests but some maybe not finished yet, + so wait for them by trying lock/unlock + */ + BLOCK_LOCK_WR(block); + BLOCK_UNLOCK_WR(block); + mysql_rwlock_destroy(&query->lock); block= block->next; } while (block != queries_blocks); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2ebcea2d6f48a0d05cdca42d58e0644560727182..e3b7b31b01d411bbdc82e09ad34b2cd30dd12fe3 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2657,6 +2657,8 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value, MEM_ROOT *runtime_memroot) { Item_change_record *change; + DBUG_ENTER("THD::nocheck_register_item_tree_change"); + DBUG_PRINT("enter", ("Register %p <- %p", old_value, (*place))); /* Now we use one node per change, which adds some memory overhead, but still is rather fast as we use alloc_root for allocations. @@ -2669,12 +2671,13 @@ void THD::nocheck_register_item_tree_change(Item **place, Item *old_value, OOM, thd->fatal_error() is called by the error handler of the memroot. Just return. */ - return; + DBUG_VOID_RETURN; } change= new (change_mem) Item_change_record; change->place= place; change->old_value= old_value; change_list.append(change); + DBUG_VOID_RETURN; } /** @@ -2696,6 +2699,9 @@ void THD::check_and_register_item_tree_change(Item **place, Item **new_value, MEM_ROOT *runtime_memroot) { Item_change_record *change; + DBUG_ENTER("THD::check_and_register_item_tree_change"); + DBUG_PRINT("enter", ("Register: %p (%p) <- %p (%p)", + *place, place, *new_value, new_value)); I_List_iterator it(change_list); while ((change= it++)) { @@ -2705,6 +2711,7 @@ void THD::check_and_register_item_tree_change(Item **place, Item **new_value, if (change) nocheck_register_item_tree_change(place, change->old_value, runtime_memroot); + DBUG_VOID_RETURN; } @@ -2712,13 +2719,13 @@ void THD::rollback_item_tree_changes() { I_List_iterator it(change_list); Item_change_record *change; - DBUG_ENTER("rollback_item_tree_changes"); while ((change= it++)) + { *change->place= change->old_value; + } /* We can forget about changes memory: it's allocated in runtime memroot */ change_list.empty(); - DBUG_VOID_RETURN; } @@ -3647,7 +3654,7 @@ void Statement::set_statement(Statement *stmt) { id= stmt->id; mark_used_columns= stmt->mark_used_columns; - lex= stmt->lex; + stmt_lex= lex= stmt->lex; query_string= stmt->query_string; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 4556487bdfecb0dced88977698ea445ad211168a..91030145022fdef1c891886ca1fd6b2b86c738c3 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1027,6 +1027,21 @@ class Statement: public ilink, public Query_arena LEX_STRING name; /* name for named prepared statements */ LEX *lex; // parse tree descriptor + /* + LEX which represents current statement (conventional, SP or PS) + + For example during view parsing THD::lex will point to the views LEX and + THD::stmt_lex will point to LEX of the statement where the view will be + included + + Currently it is used to have always correct select numbering inside + statement (LEX::current_select_number) without storing and restoring a + global counter which was THD::select_number. + + TODO: make some unified statement representation (now SP has different) + to store such data like LEX::current_select_number. + */ + LEX *stmt_lex; /* Points to the query associated with this statement. It's const, but we need to declare it char * because all table handlers are written @@ -1177,6 +1192,29 @@ typedef struct st_xid_state { /* Error reported by the Resource Manager (RM) to the Transaction Manager. */ uint rm_error; XID_cache_element *xid_cache_element; + + /** + Check that XA transaction has an uncommitted work. Report an error + to the user in case when there is an uncommitted work for XA transaction. + + @return result of check + @retval false XA transaction is NOT in state IDLE, PREPARED + or ROLLBACK_ONLY. + @retval true XA transaction is in state IDLE or PREPARED + or ROLLBACK_ONLY. + */ + + bool check_has_uncommitted_xa() const + { + if (xa_state == XA_IDLE || + xa_state == XA_PREPARED || + xa_state == XA_ROLLBACK_ONLY) + { + my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); + return true; + } + return false; + } } XID_STATE; void xid_cache_init(void); @@ -2690,7 +2728,6 @@ class THD :public Statement, uint tmp_table, global_disable_checkpoint; uint server_status,open_options; enum enum_thread_type system_thread; - uint select_number; //number of select (used for EXPLAIN) /* Current or next transaction isolation level. When a connection is established, the value is taken from @@ -3399,10 +3436,14 @@ class THD :public Statement, void change_item_tree(Item **place, Item *new_value) { + DBUG_ENTER("THD::change_item_tree"); + DBUG_PRINT("enter", ("Register: %p (%p) <- %p", + *place, place, new_value)); /* TODO: check for OOM condition here */ if (!stmt_arena->is_conventional()) nocheck_register_item_tree_change(place, *place, mem_root); *place= new_value; + DBUG_VOID_RETURN; } /** Make change in item tree after checking whether it needs registering diff --git a/sql/sql_cursor.cc b/sql/sql_cursor.cc index a8c5569ba4a8bf2f61e165ae1ef7cf3ec8601ec2..69781b5def3c0185cf5e8fa3755aeb063ea51729 100644 --- a/sql/sql_cursor.cc +++ b/sql/sql_cursor.cc @@ -211,7 +211,7 @@ void Server_side_cursor::operator delete(void *ptr, size_t size) MEM_ROOT own_root= *cursor->mem_root; DBUG_ENTER("Server_side_cursor::operator delete"); - TRASH(ptr, size); + TRASH_FREE(ptr, size); /* If this cursor has never been opened mem_root is empty. Otherwise mem_root points to the memory the cursor object was allocated in. diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 5a0879c20c495eb327bde915220ba8d7725c1e7c..b29e676bfc7ea4d74cf4752a8b0b3311835b3d9a 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -362,9 +362,16 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) SELECT_LEX *parent_lex= derived->select_lex; Query_arena *arena, backup; DBUG_ENTER("mysql_derived_merge"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); if (derived->merged) + { + + DBUG_PRINT("info", ("Irreversibly merged: exit")); DBUG_RETURN(FALSE); + } if (dt_select->uncacheable & UNCACHEABLE_RAND) { @@ -510,7 +517,9 @@ bool mysql_derived_merge(THD *thd, LEX *lex, TABLE_LIST *derived) bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived) { DBUG_ENTER("mysql_derived_merge_for_insert"); - DBUG_PRINT("enter", ("derived: %p", derived)); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); DBUG_PRINT("info", ("merged_for_insert: %d is_materialized_derived: %d " "is_multitable: %d single_table_updatable: %d " "merge_underlying_list: %d", @@ -566,7 +575,9 @@ bool mysql_derived_init(THD *thd, LEX *lex, TABLE_LIST *derived) { SELECT_LEX_UNIT *unit= derived->get_unit(); DBUG_ENTER("mysql_derived_init"); - DBUG_PRINT("enter", ("derived: %p", derived)); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); // Skip already prepared views/DT if (!unit || unit->prepared) @@ -637,8 +648,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) SELECT_LEX_UNIT *unit= derived->get_unit(); DBUG_ENTER("mysql_derived_prepare"); bool res= FALSE; - DBUG_PRINT("enter", ("unit: %p table_list: %p Alias '%s'", - unit, derived, derived->alias)); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + unit)); // Skip already prepared views/DT if (!unit || unit->prepared || @@ -669,6 +681,17 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) } unit->derived= derived; + + /* + Above cascade call of prepare is important for PS protocol, but after it + is called we can check if we really need prepare for this derived + */ + if (derived->merged) + { + DBUG_PRINT("info", ("Irreversibly merged: exit")); + DBUG_RETURN(FALSE); + } + derived->fill_me= FALSE; if (!(derived->derived_result= new (thd->mem_root) select_union(thd))) @@ -795,6 +818,14 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) bool res= FALSE; DBUG_ENTER("mysql_derived_optimize"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); + if (derived->merged) + { + DBUG_PRINT("info", ("Irreversibly merged: exit")); + DBUG_RETURN(FALSE); + } if (unit->optimized) DBUG_RETURN(FALSE); @@ -860,6 +891,9 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived) { DBUG_ENTER("mysql_derived_create"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); TABLE *table= derived->table; SELECT_LEX_UNIT *unit= derived->get_unit(); @@ -909,9 +943,13 @@ bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived) bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) { - DBUG_ENTER("mysql_derived_fill"); + Field_iterator_table field_iterator; SELECT_LEX_UNIT *unit= derived->get_unit(); bool res= FALSE; + DBUG_ENTER("mysql_derived_fill"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); if (unit->executed && !unit->uncacheable && !unit->describe) DBUG_RETURN(FALSE); @@ -951,7 +989,27 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) if (derived_result->flush()) res= TRUE; unit->executed= TRUE; + + if (derived->field_translation) + { + /* reset translation table to materialized table */ + field_iterator.set_table(derived->table); + for (uint i= 0; + !field_iterator.end_of_fields(); + field_iterator.next(), i= i + 1) + { + Item *item; + + if (!(item= field_iterator.create_item(thd))) + { + res= TRUE; + break; + } + thd->change_item_tree(&derived->field_translation[i].item, item); + } + } } + if (res || !lex->describe) unit->cleanup(); lex->current_select= save_current_select; @@ -980,6 +1038,9 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) bool mysql_derived_reinit(THD *thd, LEX *lex, TABLE_LIST *derived) { DBUG_ENTER("mysql_derived_reinit"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (derived->alias ? derived->alias : ""), + derived->get_unit())); st_select_lex_unit *unit= derived->get_unit(); derived->merged_for_insert= FALSE; diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 4d0ba38d8107f356a1bc06a4dddda18f8aa09691..caacf6b3a2fe24d03d1885a58740982ff2666d1a 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -208,6 +208,9 @@ class Explain_select : public Explain_basic_join Explain_select(MEM_ROOT *root, bool is_analyze) : Explain_basic_join(root), +#ifndef DBUG_OFF + select_lex(NULL), +#endif message(NULL), having(NULL), having_value(Item::COND_UNDEF), using_temporary(false), using_filesort(false), @@ -222,6 +225,9 @@ class Explain_select : public Explain_basic_join void replace_table(uint idx, Explain_table_access *new_tab); public: +#ifndef DBUG_OFF + SELECT_LEX *select_lex; +#endif const char *select_type; /* diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index c39860593b681f64c581a85bd03a1cba20f97036..0a9ce00c95089f6cbc692f56663e6475c6bb6baa 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2016, MariaDB + Copyright (c) 2010, 2018, 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 diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 75e692988098caf334786d46efee5388e6635352..4b7667f1319996f524e1e2a7a8816d3694125b24 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -394,7 +394,7 @@ void JOIN_CACHE::create_flag_fields() TABLE *table= tab->table; /* Create a field for the null bitmap from table if needed */ - if (tab->used_null_fields || tab->used_uneven_bit_fields) + if (tab->used_null_fields || tab->used_uneven_bit_fields) length+= add_flag_field_to_join_cache(table->null_flags, table->s->null_bytes, ©); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 63ab6b5d046b686c5b5794a6e222f5cd68b7e643..3fa5ec71aeb67d65c76ec8027582434c451e3738 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2009, 2018, 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 @@ -657,6 +657,7 @@ void lex_start(THD *thd) { LEX *lex= thd->lex; DBUG_ENTER("lex_start"); + DBUG_PRINT("info", ("Lex %p stmt_lex: %p", thd->lex, thd->stmt_lex)); lex->thd= lex->unit.thd= thd; @@ -668,6 +669,7 @@ void lex_start(THD *thd) /* 'parent_lex' is used in init_query() so it must be before it. */ lex->select_lex.parent_lex= lex; lex->select_lex.init_query(); + lex->current_select_number= 1; lex->value_list.empty(); lex->update_list.empty(); lex->set_var_list.empty(); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b57fba08b4756987212913d51805c591e56b78db..4fcd090e1f5bd98fb324c16ea48dbe56392f87f9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2010, 2016, MariaDB + Copyright (c) 2010, 2018, 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 @@ -502,7 +502,7 @@ class st_select_lex_node { } static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return (void*) alloc_root(mem_root, (uint) size); } - static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); } + static void operator delete(void *ptr,size_t size) { TRASH_FREE(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) {} // Ensures that at least all members used during cleanup() are initialized. @@ -727,7 +727,13 @@ class st_select_lex: public st_select_lex_node Item *prep_having;/* saved HAVING clause for prepared statement processing */ /* Saved values of the WHERE and HAVING clauses*/ Item::cond_result cond_value, having_value; - /* point on lex in which it was created, used in view subquery detection */ + /* + Point to the LEX in which it was created, used in view subquery detection. + + TODO: make also st_select_lex::parent_stmt_lex (see THD::stmt_lex) + and use st_select_lex::parent_lex & st_select_lex::parent_stmt_lex + instead of global (from THD) references where it is possible. + */ LEX *parent_lex; enum olap_type olap; /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */ @@ -2452,7 +2458,7 @@ struct LEX: public Query_tables_list /** SELECT of CREATE VIEW statement */ LEX_STRING create_view_select; - uint number_of_selects; // valid only for view + uint current_select_number; // valid for statment LEX (not view) /** Start of 'ON table', in trigger statements. */ const char* raw_trg_on_table_name_begin; diff --git a/sql/sql_lifo_buffer.h b/sql/sql_lifo_buffer.h index 8fa13c66dd936c8404f25fddcd5ea4dd333678a5..17024d15beb59736116a372e3cc14ea1feaae827 100644 --- a/sql/sql_lifo_buffer.h +++ b/sql/sql_lifo_buffer.h @@ -84,7 +84,7 @@ class Lifo_buffer start= start_arg; end= end_arg; if (end != start) - TRASH(start, end - start); + TRASH_ALLOC(start, end - start); reset(); } @@ -224,7 +224,7 @@ class Forward_lifo_buffer: public Lifo_buffer { DBUG_ASSERT(unused_end >= unused_start); DBUG_ASSERT(end == unused_start); - TRASH(unused_start, unused_end - unused_start); + TRASH_ALLOC(unused_start, unused_end - unused_start); end= unused_end; } /* Return pointer to start of the memory area that is occupied by the data */ diff --git a/sql/sql_list.h b/sql/sql_list.h index 6f01b64df7075876c39c353585028fc6566da148..7fb9c19d2cf061b3c34f3bf8b07f5ef4654daa25 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -41,12 +41,12 @@ class Sql_alloc { return alloc_root(mem_root, size); } static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return alloc_root(mem_root, size); } - static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } + static void operator delete(void *ptr, size_t size) { TRASH_FREE(ptr, size); } static void operator delete(void *ptr, MEM_ROOT *mem_root) { /* never called */ } static void operator delete[](void *ptr, MEM_ROOT *mem_root) { /* never called */ } - static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); } + static void operator delete[](void *ptr, size_t size) { TRASH_FREE(ptr, size); } #ifdef HAVE_valgrind bool dummy_for_valgrind; inline Sql_alloc() :dummy_for_valgrind(0) {} diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 6084c59a257c0fea1dfaa6e04d559d01c2d308c9..4dd8d9e124ee0d42b705aff7681ecf302659fbe6 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6903,7 +6903,12 @@ void THD::reset_for_next_command(bool do_clear_error) clear_error(1); thd->free_list= 0; - thd->select_number= 1; + /* + We also assign thd->stmt_lex in lex_start(), but during bootstrap this + code is executed first. + */ + thd->stmt_lex= &main_lex; thd->stmt_lex->current_select_number= 1; + DBUG_PRINT("info", ("Lex %p stmt_lex: %p", thd->lex, thd->stmt_lex)); /* Those two lines below are theoretically unneeded as THD::cleanup_after_query() should take care of this already. @@ -7021,7 +7026,7 @@ mysql_new_select(LEX *lex, bool move_down) if (!(select_lex= new (thd->mem_root) SELECT_LEX())) DBUG_RETURN(1); - select_lex->select_number= ++thd->select_number; + select_lex->select_number= ++thd->stmt_lex->current_select_number; select_lex->parent_lex= lex; /* Used in init_query. */ select_lex->init_query(); select_lex->init_select(); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 941182dda53274d59040f1f8264606c5700b82e2..13e5f16685c7433cf2f7ce6d659c2344204cc5e2 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4709,7 +4709,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, DBUG_RETURN(TRUE); } - thd->work_part_info= thd->lex->part_info; + /* + One of these is done in handle_if_exists_option(): + thd->work_part_info= thd->lex->part_info; + or + thd->work_part_info= NULL; + */ if (thd->work_part_info && !(thd->work_part_info= thd->work_part_info->get_clone(thd))) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 3a4097734ec488967816e8e59f86aa98010dfe69..d57137b30f65e3555d15885c925317d2aa080d45 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -487,6 +487,11 @@ static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl) sizeof(struct st_plugin_dl)); DBUG_RETURN(tmp); } +#else +static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *) +{ + return 0; +} #endif /* HAVE_DLOPEN */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index e5b85c3be4504201bec4ddd4392a58d4f4d8b253..b515578eb053a796dcdfe6cdae192541e71f5778 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -164,20 +164,6 @@ class Prepared_statement: public Statement uint param_count; uint last_errno; uint flags; - /* - The value of thd->select_number at the end of the PREPARE phase. - - The issue is: each statement execution opens VIEWs, which may cause - select_lex objects to be created, and select_number values to be assigned. - - On the other hand, PREPARE assigns select_number values for triggers and - subqueries. - - In order for select_number values from EXECUTE not to conflict with - select_number values from PREPARE, we keep the number and set it at each - execution. - */ - uint select_number_after_prepare; char last_error[MYSQL_ERRMSG_SIZE]; #ifndef EMBEDDED_LIBRARY bool (*set_params)(Prepared_statement *st, uchar *data, uchar *data_end, @@ -3563,9 +3549,9 @@ void Prepared_statement::cleanup_stmt() DBUG_ENTER("Prepared_statement::cleanup_stmt"); DBUG_PRINT("enter",("stmt: 0x%lx", (long) this)); thd->restore_set_statement_var(); + thd->rollback_item_tree_changes(); cleanup_items(free_list); thd->cleanup_after_query(); - thd->rollback_item_tree_changes(); DBUG_VOID_RETURN; } @@ -3649,6 +3635,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) if (! (lex= new (mem_root) st_lex_local)) DBUG_RETURN(TRUE); + stmt_lex= lex; if (set_db(thd->db, thd->db_length)) DBUG_RETURN(TRUE); @@ -3754,8 +3741,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) trans_rollback_implicit(thd); thd->mdl_context.release_transactional_locks(); } - - select_number_after_prepare= thd->select_number; /* Preserve CHANGE MASTER attributes */ lex_end_stage1(lex); @@ -3891,7 +3876,6 @@ Prepared_statement::execute_loop(String *expanded_query, */ DBUG_ASSERT(thd->free_list == NULL); - thd->select_number= select_number_after_prepare; /* Check if we got an error when sending long data */ if (state == Query_arena::STMT_ERROR) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b9fe8f3162a0c9b343ef44f8a9bf763ef7fd5af2..067c71205d014a7fa2dafa74c97cd3a7e11eed60 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016 Oracle and/or its affiliates. - Copyright (c) 2009, 2016 MariaDB + Copyright (c) 2009, 2018 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 @@ -291,6 +291,11 @@ JOIN_TAB *next_depth_first_tab(JOIN* join, JOIN_TAB* tab); static JOIN_TAB *next_breadth_first_tab(JOIN_TAB *first_top_tab, uint n_top_tabs_count, JOIN_TAB *tab); +static bool +find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, + ORDER *order, List &fields, List &all_fields, + bool is_group_field, bool add_to_all_fields); + static double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s, table_map rem_tables); @@ -344,7 +349,6 @@ bool dbug_user_var_equals_int(THD *thd, const char *name, int value) } #endif - /** This handles SELECT with and without UNION. */ @@ -708,6 +712,9 @@ JOIN::prepare(Item ***rref_pointer_array, join_list= &select_lex->top_join_list; union_part= unit_arg->is_union(); + // simple check that we got usable conds + dbug_print_item(conds); + if (select_lex->handle_derived(thd->lex, DT_PREPARE)) DBUG_RETURN(1); @@ -810,9 +817,15 @@ JOIN::prepare(Item ***rref_pointer_array, if (skip_order_by && select_lex != select_lex->master_unit()->global_parameters()) { - if (setup_order(thd, (*rref_pointer_array), tables_list, fields_list, - all_fields, select_lex->order_list.first)) - DBUG_RETURN(-1); + thd->where= "order clause"; + for (ORDER *order= select_lex->order_list.first; order; order= order->next) + { + /* Don't add the order items to all fields. Just resolve them to ensure + the query is valid, we'll drop them immediately after. */ + if (find_order_in_list(thd, *rref_pointer_array, tables_list, order, + fields_list, all_fields, false, false)) + DBUG_RETURN(-1); + } select_lex->order_list.empty(); } @@ -2323,8 +2336,11 @@ bool JOIN::shrink_join_buffers(JOIN_TAB *jt, ulonglong curr_space, ulonglong needed_space) { + JOIN_TAB *tab; JOIN_CACHE *cache; - for (JOIN_TAB *tab= join_tab+const_tables; tab < jt; tab++) + for (tab= first_linear_tab(this, WITHOUT_BUSH_ROOTS, WITHOUT_CONST_TABLES); + tab != jt; + tab= next_linear_tab(this, tab, WITHOUT_BUSH_ROOTS)) { cache= tab->cache; if (cache) @@ -2462,6 +2478,17 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite, bool need_tmp_table, bool need_order, bool distinct) { + /* + If there is SELECT in this statemet with the same number it must be the + same SELECT + */ + DBUG_ASSERT(select_lex->select_number == UINT_MAX || + select_lex->select_number == INT_MAX || + !output || + !output->get_select(select_lex->select_number) || + output->get_select(select_lex->select_number)->select_lex == + select_lex); + if (select_lex->select_number != UINT_MAX && select_lex->select_number != INT_MAX /* this is not a UNION's "fake select */ && have_query_plan != JOIN::QEP_NOT_PRESENT_YET && @@ -10439,7 +10466,7 @@ void JOIN::drop_unused_derived_keys() tmp_tbl->use_index(tab->ref.key); if (tmp_tbl->s->keys) { - if (tab->ref.key >= 0) + if (tab->ref.key >= 0 && tab->ref.key < MAX_KEY) tab->ref.key= 0; else tmp_tbl->s->keys= 0; @@ -12258,8 +12285,8 @@ static void update_depend_map(JOIN *join) uint i; for (i=0 ; i < ref->key_parts ; i++,item++) depend_map|=(*item)->used_tables(); - ref->depend_map=depend_map & ~OUTER_REF_TABLE_BIT; depend_map&= ~OUTER_REF_TABLE_BIT; + ref->depend_map= depend_map; for (JOIN_TAB **tab=join->map2table; depend_map ; tab++,depend_map>>=1 ) @@ -12634,7 +12661,7 @@ class COND_CMP :public ilink { } static void operator delete(void *ptr __attribute__((unused)), size_t size __attribute__((unused))) - { TRASH(ptr, size); } + { TRASH_FREE(ptr, size); } Item *and_level; Item_bool_func2 *cmp_func; @@ -15633,9 +15660,10 @@ COND * Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value, bool top_level_arg) { - if (args[0]->type() == Item::FIELD_ITEM) + Item *real_item= args[0]->real_item(); + if (real_item->type() == Item::FIELD_ITEM) { - Field *field= ((Item_field*) args[0])->field; + Field *field= ((Item_field*) real_item)->field; if (((field->type() == MYSQL_TYPE_DATE) || (field->type() == MYSQL_TYPE_DATETIME)) && @@ -16841,7 +16869,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, field->set_notnull(); memcpy(field->ptr, orig_field->ptr_in_record(orig_field->table->s->default_values), - field->pack_length()); + field->pack_length_in_rec()); } } @@ -22133,7 +22161,10 @@ cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref) SELECT list) @param[in,out] all_fields All select, group and order by fields @param[in] is_group_field True if order is a GROUP field, false if - ORDER by field + ORDER by field + @param[in] add_to_all_fields If the item is to be added to all_fields and + ref_pointer_array, this flag can be set to + false to stop the automatic insertion. @retval FALSE if OK @@ -22144,7 +22175,7 @@ cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref) static bool find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, ORDER *order, List &fields, List &all_fields, - bool is_group_field) + bool is_group_field, bool add_to_all_fields) { Item *order_item= *order->item; /* The item from the GROUP/ORDER caluse. */ Item::Type order_item_type; @@ -22268,6 +22299,9 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, thd->is_error())) return TRUE; /* Wrong field. */ + if (!add_to_all_fields) + return FALSE; + uint el= all_fields.elements; DBUG_ASSERT(all_fields.elements <= thd->lex->current_select->ref_pointer_array_size); @@ -22298,13 +22332,13 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, */ int setup_order(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, - List &fields, List &all_fields, ORDER *order) + List &fields, List &all_fields, ORDER *order) { thd->where="order clause"; for (; order; order=order->next) { if (find_order_in_list(thd, ref_pointer_array, tables, order, fields, - all_fields, FALSE)) + all_fields, FALSE, true)) return 1; } return 0; @@ -22356,7 +22390,7 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, for (ord= order; ord; ord= ord->next) { if (find_order_in_list(thd, ref_pointer_array, tables, ord, fields, - all_fields, TRUE)) + all_fields, TRUE, true)) return 1; (*ord->item)->marker= UNDEF_POS; /* Mark found */ if ((*ord->item)->with_sum_func) @@ -22675,6 +22709,7 @@ get_sort_by_table(ORDER *a,ORDER *b, List &tables, if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT))) DBUG_RETURN(0); + map&= ~const_tables; while ((table= ti++) && !(map & table->table->map)) ; if (map != table->table->map) DBUG_RETURN(0); // More than one table @@ -24601,6 +24636,11 @@ int JOIN::save_explain_data_intern(Explain_query *output, bool need_tmp_table, { explain= new (output->mem_root) Explain_select(output->mem_root, thd->lex->analyze_stmt); + if (!explain) + DBUG_RETURN(1); // EoM +#ifndef DBUG_OFF + explain->select_lex= select_lex; +#endif join->select_lex->set_explain_type(true); explain->select_id= join->select_lex->select_number; diff --git a/sql/sql_select.h b/sql/sql_select.h index 7b9c03824ebc7cfe55d6f90108bdfd30ca885d17..8c55528e12040c981c7253fea3e81e681c823f1f 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1839,7 +1839,7 @@ SORT_FIELD *make_unireg_sortorder(THD *thd, JOIN *join, ORDER *order, uint *length, SORT_FIELD *sortorder); int setup_order(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, - List &fields, List &all_fields, ORDER *order); + List &fields, List &all_fields, ORDER *order); int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, List &fields, List &all_fields, ORDER *order, bool *hidden_group_fields); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2c02f9326db876f4f42e98c54c8c80761a1dfedd..5a78a27a90719b06e272bd3e3da2af6ec965db22 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2414,7 +2414,7 @@ class thread_info :public ilink { { return alloc_root(mem_root, size); } static void operator delete(void *ptr __attribute__((unused)), size_t size __attribute__((unused))) - { TRASH(ptr, size); } + { TRASH_FREE(ptr, size); } ulong thread_id; uint32 os_thread_id; diff --git a/sql/sql_string.h b/sql/sql_string.h index 51a11c7a4ffa337cb2624d9333d33b54dae13e7c..b8979d397e662b53362d189eb62e84833f5d6dac 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -149,7 +149,7 @@ class String { (void) ptr_arg; (void) size; - TRASH(ptr_arg, size); + TRASH_FREE(ptr_arg, size); } static void operator delete(void *, MEM_ROOT *) { /* never called */ } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 277d8370dd8f7db6bb51bbcc653f6dc1bf5906b9..44df4bba7677c16534cb1ade296ba091bd920ff5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1829,7 +1829,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) #endif /* Write shadow frm file */ lpt->create_info->table_options= lpt->db_options; - LEX_CUSTRING frm= build_frm_image(lpt->thd, lpt->table_name, + LEX_CUSTRING frm= build_frm_image(lpt->thd, + lpt->table_name, lpt->create_info, lpt->alter_info->create_list, lpt->key_count, lpt->key_info_buffer, @@ -6037,6 +6038,7 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info) #ifdef WITH_PARTITION_STORAGE_ENGINE partition_info *tab_part_info= table->part_info; + thd->work_part_info= thd->lex->part_info; if (tab_part_info) { /* ALTER TABLE ADD PARTITION IF NOT EXISTS */ @@ -6057,7 +6059,7 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info) ER_THD(thd, ER_SAME_NAME_PARTITION), pe->partition_name); alter_info->flags&= ~Alter_info::ALTER_ADD_PARTITION; - thd->lex->part_info= NULL; + thd->work_part_info= NULL; break; } } @@ -9679,11 +9681,12 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, if ((int) key_nr >= 0) { const char *err_msg= ER_THD(thd, ER_DUP_ENTRY_WITH_KEY_NAME); - if (key_nr == 0 && + if (key_nr == 0 && to->s->keys > 0 && (to->key_info[0].key_part[0].field->flags & AUTO_INCREMENT_FLAG)) err_msg= ER_THD(thd, ER_DUP_ENTRY_AUTOINCREMENT_CASE); - print_keydup_error(to, key_nr == MAX_KEY ? NULL : + print_keydup_error(to, + key_nr >= to->s->keys ? NULL : &to->key_info[key_nr], err_msg, MYF(0)); } diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 0b4978b286295c992aa9f28b11f920da791b02f6..70e9b36c56e3ce25e1888baff418018fdaf8fa2a 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1373,12 +1373,13 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, List_iterator_fast it_client_cs_name(triggers->client_cs_names); List_iterator_fast it_connection_cl_name(triggers->connection_cl_names); List_iterator_fast it_db_cl_name(triggers->db_cl_names); - LEX *old_lex= thd->lex, lex; + LEX *old_lex= thd->lex, *old_stmt_lex= thd->stmt_lex; + LEX lex; sp_rcontext *save_spcont= thd->spcont; ulonglong save_sql_mode= thd->variables.sql_mode; LEX_STRING *on_table_name; - thd->lex= &lex; + thd->lex= thd->stmt_lex= &lex; save_db.str= thd->db; save_db.length= thd->db_length; @@ -1577,6 +1578,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, } thd->reset_db(save_db.str, save_db.length); thd->lex= old_lex; + thd->stmt_lex= old_stmt_lex; thd->spcont= save_spcont; thd->variables.sql_mode= save_sql_mode; @@ -1589,6 +1591,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, // QQ: anything else ? lex_end(&lex); thd->lex= old_lex; + thd->stmt_lex= old_stmt_lex; thd->spcont= save_spcont; thd->variables.sql_mode= save_sql_mode; thd->reset_db(save_db.str, save_db.length); diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 9d825f55fcb3c53a3538870a936a37dc0b00a198..e12cae0f80e9830e3ddab3e8bdabcc163a2c3885 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1093,22 +1093,6 @@ bool st_select_lex_unit::cleanup() void st_select_lex_unit::reinit_exec_mechanism() { prepared= optimized= executed= 0; -#ifndef DBUG_OFF - if (is_union()) - { - List_iterator_fast it(item_list); - Item *field; - while ((field= it++)) - { - /* - we can't cleanup here, because it broke link to temporary table field, - but have to drop fixed flag to allow next fix_field of this field - during re-executing - */ - field->fixed= 0; - } - } -#endif } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e1d22e6a1e9ff95c477da8b873b6d1a898804bed..db9f9013188235a3698411d887745d485325b8a9 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -701,6 +701,8 @@ int mysql_update(THD *thd, if (reinit_io_cache(&tempfile,READ_CACHE,0L,0,0)) error=1; /* purecov: inspected */ select->file=tempfile; // Read row ptrs from this file + // select->file was copied, update self-references. + setup_io_cache(&select->file); if (error >= 0) goto err; } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 0f08883639aaac85af375e703ffcf77c9ddd314d..1bdc76a66ea00c4e8105f5c08b86e9d4ac16d0e3 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -1187,8 +1187,6 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, */ mysql_derived_reinit(thd, NULL, table); - thd->select_number+= table->view->number_of_selects; - DEBUG_SYNC(thd, "after_cached_view_opened"); DBUG_RETURN(0); } @@ -1343,7 +1341,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, lex_start(thd); view_select= &lex->select_lex; - view_select->select_number= ++thd->select_number; + view_select->select_number= ++thd->stmt_lex->current_select_number; ulonglong saved_mode= thd->variables.sql_mode; /* switch off modes which can prevent normal parsing of VIEW @@ -1377,9 +1375,6 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, parse_status= parse_sql(thd, & parser_state, table->view_creation_ctx); - lex->number_of_selects= - (thd->select_number - view_select->select_number) + 1; - /* Restore environment. */ if ((old_lex->sql_command == SQLCOM_SHOW_FIELDS) || diff --git a/sql/table.cc b/sql/table.cc index 6b1ae3d0245d49be90b1775e6b3a07b0aef9a4f6..ea0bc8f5c95e78dc0c190773f2ff507e947518ef 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1340,9 +1340,10 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, extra_rec_buf_length= uint2korr(frm_image+59); rec_buff_length= ALIGN_SIZE(share->reclength + 1 + extra_rec_buf_length); share->rec_buff_length= rec_buff_length; - if (!(record= (uchar *) alloc_root(&share->mem_root, - rec_buff_length))) + if (!(record= (uchar *) alloc_root(&share->mem_root, rec_buff_length))) goto err; /* purecov: inspected */ + MEM_NOACCESS(record, rec_buff_length); + MEM_UNDEFINED(record, share->reclength); share->default_values= record; memcpy(record, frm_image + record_offset, share->reclength); @@ -2685,6 +2686,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, if (!(record= (uchar*) alloc_root(&outparam->mem_root, share->rec_buff_length * records))) goto err; /* purecov: inspected */ + MEM_NOACCESS(record, share->rec_buff_length * records); if (records == 0) { @@ -2699,6 +2701,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, else outparam->record[1]= outparam->record[0]; // Safety } + MEM_UNDEFINED(outparam->record[0], share->reclength); + MEM_UNDEFINED(outparam->record[1], share->reclength); if (!(field_ptr = (Field **) alloc_root(&outparam->mem_root, (uint) ((share->fields+1)* @@ -4260,6 +4264,9 @@ bool TABLE_LIST::create_field_translation(THD *thd) Query_arena *arena, backup; bool res= FALSE; DBUG_ENTER("TABLE_LIST::create_field_translation"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (alias ? alias : ""), + get_unit())); if (thd->stmt_arena->is_conventional() || thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) diff --git a/sql/table.h b/sql/table.h index 7d9b5292a064c5310229f95ead2d6b32f15634df..5abb99cd0c78a468c5b35c028ca32597dc299e9f 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2287,6 +2287,9 @@ struct TABLE_LIST inline void set_merged_derived() { DBUG_ENTER("set_merged_derived"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (alias ? alias : ""), + get_unit())); derived_type= ((derived_type & DTYPE_MASK) | DTYPE_TABLE | DTYPE_MERGE); set_check_merged(); @@ -2299,6 +2302,9 @@ struct TABLE_LIST void set_materialized_derived() { DBUG_ENTER("set_materialized_derived"); + DBUG_PRINT("enter", ("Alias: '%s' Unit: %p", + (alias ? alias : ""), + get_unit())); derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) | DTYPE_TABLE | DTYPE_MATERIALIZE); set_check_materialized(); diff --git a/sql/transaction.cc b/sql/transaction.cc index f03cced7bc8bc606b203f046d57d26c0b3905406..1744feea15151142edf4d78ee16193507825e174 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -536,12 +536,8 @@ bool trans_savepoint(THD *thd, LEX_STRING name) !opt_using_transactions) DBUG_RETURN(FALSE); - enum xa_states xa_state= thd->transaction.xid_state.xa_state; - if (xa_state != XA_NOTR && xa_state != XA_ACTIVE) - { - my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); + if (thd->transaction.xid_state.check_has_uncommitted_xa()) DBUG_RETURN(TRUE); - } sv= find_savepoint(thd, name); @@ -616,12 +612,8 @@ bool trans_rollback_to_savepoint(THD *thd, LEX_STRING name) DBUG_RETURN(TRUE); } - enum xa_states xa_state= thd->transaction.xid_state.xa_state; - if (xa_state != XA_NOTR) - { - my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); + if (thd->transaction.xid_state.check_has_uncommitted_xa()) DBUG_RETURN(TRUE); - } /** Checking whether it is safe to release metadata locks acquired after diff --git a/sql/unireg.cc b/sql/unireg.cc index 66959f400d90915c595e1c66a2a811c28b41075a..e41cca2dfcb5e04c94371085de54677140dcdf47 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab. + Copyright (c) 2009, 2018, 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 @@ -83,7 +83,7 @@ static uchar *extra2_write(uchar *pos, enum extra2_frm_value_type type, return extra2_write(pos, type, reinterpret_cast(str)); } -/** +/* Create a frm (table definition) file @param thd Thread handler @@ -160,7 +160,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, DBUG_PRINT("info", ("Options length: %u", options_len)); if (validate_comment_length(thd, &create_info->comment, TABLE_COMMENT_MAXLEN, - ER_TOO_LONG_TABLE_COMMENT, table)) + ER_TOO_LONG_TABLE_COMMENT, + table)) DBUG_RETURN(frm); /* If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes, @@ -263,6 +264,14 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, DBUG_ASSERT(pos == frm_ptr + uint2korr(fileinfo+6)); key_info_length= pack_keys(pos, keys, key_info, data_offset); + if (key_info_length > UINT_MAX16) + { + my_printf_error(ER_CANT_CREATE_TABLE, + "Cannot create table %`s: index information is too long. " + "Decrease number of indexes or use shorter index names or shorter comments.", + MYF(0), table); + goto err; + } int2store(forminfo+2, frm.length - filepos); int4store(fileinfo+10, frm.length); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index bdc8491080db2e44f0652d51b8b224b225338239..285bb520b87d4ed676022407207fe7632d4c1213 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1227,6 +1227,16 @@ int wsrep_to_buf_helper( if (!ret && writer.write(>id_ev)) ret= 1; } #endif /* GTID_SUPPORT */ + if (wsrep_gtid_mode && thd->variables.gtid_seq_no) + { + Gtid_log_event gtid_event(thd, thd->variables.gtid_seq_no, + thd->variables.gtid_domain_id, + true, LOG_EVENT_SUPPRESS_USE_F, + true, 0); + gtid_event.server_id= thd->variables.server_id; + if (!gtid_event.is_valid()) ret= 0; + ret= writer.write(>id_event); + } /* if there is prepare query, add event for it */ if (!ret && thd->wsrep_TOI_pre_query) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 35f218e425f872b9135839488b2c3c87c8c97b1a..94804a6d3c7b7a93489d2699801be262b27f6d5e 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -30,9 +30,10 @@ #include #include -char wsrep_defaults_file[FN_REFLEN * 2 + 10 + - sizeof(WSREP_SST_OPT_CONF) + - sizeof(WSREP_SST_OPT_EXTRA_CONF)] = {0}; +static char wsrep_defaults_file[FN_REFLEN * 2 + 10 + 30 + + sizeof(WSREP_SST_OPT_CONF) + + sizeof(WSREP_SST_OPT_CONF_SUFFIX) + + sizeof(WSREP_SST_OPT_CONF_EXTRA)] = {0}; const char* wsrep_sst_method = WSREP_SST_DEFAULT; const char* wsrep_sst_receive_address = WSREP_SST_ADDRESS_AUTO; @@ -75,7 +76,11 @@ static void make_wsrep_defaults_file() if (my_defaults_extra_file) ptr= strxnmov(ptr, end - ptr, - WSREP_SST_OPT_EXTRA_CONF, " '", my_defaults_extra_file, "' ", NULL); + WSREP_SST_OPT_CONF_EXTRA, " '", my_defaults_extra_file, "' ", NULL); + + if (my_defaults_group_suffix) + ptr= strxnmov(ptr, end - ptr, + WSREP_SST_OPT_CONF_SUFFIX, " '", my_defaults_group_suffix, "' ", NULL); } } @@ -581,8 +586,8 @@ static ssize_t sst_prepare_other (const char* method, WSREP_SST_OPT_PARENT" '%d'" " %s '%s' ", method, addr_in, mysql_real_data_home, - wsrep_defaults_file, (int)getpid(), - binlog_opt, binlog_opt_val); + wsrep_defaults_file, + (int)getpid(), binlog_opt, binlog_opt_val); my_free(binlog_opt_val); if (ret < 0 || ret >= cmd_len) @@ -864,7 +869,7 @@ static int sst_donate_mysqldump (const char* addr, WSREP_SST_OPT_PORT" '%d' " WSREP_SST_OPT_LPORT" '%u' " WSREP_SST_OPT_SOCKET" '%s' " - " %s " + " '%s' " WSREP_SST_OPT_GTID" '%s:%lld' " WSREP_SST_OPT_GTID_DOMAIN_ID" '%d'" "%s", diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h index 49dd5b39fad79b25609ff99e96a7f69a21cb42bc..dcf0ff226515353ea9d141846210ee2d9cfbb71f 100644 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@ -27,7 +27,8 @@ #define WSREP_SST_OPT_AUTH "--auth" #define WSREP_SST_OPT_DATA "--datadir" #define WSREP_SST_OPT_CONF "--defaults-file" -#define WSREP_SST_OPT_EXTRA_CONF "--defaults-extra-file" +#define WSREP_SST_OPT_CONF_SUFFIX "--defaults-group-suffix" +#define WSREP_SST_OPT_CONF_EXTRA "--defaults-extra-file" #define WSREP_SST_OPT_PARENT "--parent" #define WSREP_SST_OPT_BINLOG "--binlog" diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 69b2ef783168f6578d0db1659cea1f817f4252a8..e283da97c4bf087945a71b2582c60d22950c9779 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -61,7 +61,7 @@ IF(UNIX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fexceptions -fPIC ") get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES) - SET(CONNECT_SOURCES ${CONNECT_SOURCES} inihandl.c) + SET(CONNECT_SOURCES ${CONNECT_SOURCES} inihandl.cpp) SET(IPHLPAPI_LIBRARY "") ELSE(NOT UNIX) SET(CONNECT_SOURCES ${CONNECT_SOURCES} @@ -228,7 +228,7 @@ int main() { ENDIF(CONNECT_WITH_ODBC) # -# JDBC with MongoDB Java Driver included but disabled +# JDBC with MongoDB Java Driver included but disabled if without MONGO # # OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON) OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON) diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c index 64429d9b93ec13a82cb468272ad3299c6392809c..a8d48a5d3b1deb8730f80705f7e36a969472b1b6 100644 --- a/storage/connect/fmdlex.c +++ b/storage/connect/fmdlex.c @@ -529,7 +529,7 @@ YY_DECL pp->Num = 0; if (pp->InFmt) {*pp->InFmt = '\0'; pp->InFmt[pp->Outsize -1] = '\0'; } if (pp->OutFmt) {*pp->OutFmt = '\0'; pp->OutFmt[pp->Outsize -1] = '\0'; } - pp->Curp = pp->Format; + pp->Curp = (char*) pp->Format; yy_init = 1; /* This is a new input */ diff --git a/storage/connect/global.h b/storage/connect/global.h index de7a9fb3c0317461781fc67123d514102a6f5836..e4b00786efa795a53776a3d7994c60633a42be6c 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -217,7 +217,8 @@ DllExport int PlugExit(PGLOBAL); // Plug global termination DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR); DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir); DllExport BOOL PlugIsAbsolutePath(LPCSTR path); -DllExport void *PlugAllocMem(PGLOBAL, uint); +DllExport bool AllocSarea(PGLOBAL, uint); +DllExport void FreeSarea(PGLOBAL); DllExport BOOL PlugSubSet(PGLOBAL, void *, uint); DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t); DllExport char *PlugDup(PGLOBAL g, const char *str); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 787ec2affc1c9f19466a4c7eafed97aaffda7024..5964b1d049f4ae127a4c258b5cf414110179a0b0 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -215,9 +215,9 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); PQRYRES VirColumns(PGLOBAL g, bool info); PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info); PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info); -#if defined(MONGO_SUPPORT) +#if defined(JAVA_SUPPORT) PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ url, PTOS topt, bool info); -#endif // MONGO_SUPPORT +#endif // JAVA_SUPPORT int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v); void PushWarning(PGLOBAL g, THD *thd, int level); bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, PCSZ host, PCSZ db, @@ -371,13 +371,6 @@ static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG, NULL, NULL, MONGO_ENABLED); #endif // 0 -#if defined(MONGO_SUPPORT) -// Enabling MONGO table type -static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG, - "Enabling the MongoDB access", - NULL, NULL, MONGO_ENABLED); -#endif // MONGO_SUPPORT - #if defined(XMSG) || defined(NEWMSG) const char *language_names[]= { @@ -442,10 +435,6 @@ char *GetJavaWrapper(void) //bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); } #endif // JAVA_SUPPORT -#if defined(MONGO_SUPPORT) -bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); } -#endif // MONGO_SUPPORT - extern "C" const char *msglang(void) { #if defined(FRENCH) @@ -3020,7 +3009,9 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) return NULL; if (!x) { + const char *p; char *s = (ishav) ? havg : body; + uint j, k, n; // Append the value to the filter switch (args[i]->field_type()) { @@ -3076,16 +3067,38 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) strcat(s, "'}"); break; default: - strcat(s, "'"); - strncat(s, res->ptr(), res->length()); - strcat(s, "'"); - } // endswitch field type + j = strlen(s); + s[j++] = '\''; + p = res->ptr(); + n = res->length(); + + for (k = 0; k < n; k++) { + if (p[k] == '\'') + s[j++] = '\''; + + s[j++] = p[k]; + } // endfor k + + s[j++] = '\''; + s[j] = 0; + } // endswitch field type } else { - strcat(s, "'"); - strncat(s, res->ptr(), res->length()); - strcat(s, "'"); - } // endif tty + j = strlen(s); + s[j++] = '\''; + p = res->ptr(); + n = res->length(); + + for (k = 0; k < n; k++) { + if (p[k] == '\'') + s[j++] = '\''; + + s[j++] = p[k]; + } // endfor k + + s[j++] = '\''; + s[j] = 0; + } // endif tty break; default: diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.cpp similarity index 97% rename from storage/connect/inihandl.c rename to storage/connect/inihandl.cpp index 0ce0eb9fa0d6ad1ac972e8d135419ab979593f63..96ae0a67a6bdd4d4857106cfd37744fdc797e0ff 100644 --- a/storage/connect/inihandl.c +++ b/storage/connect/inihandl.cpp @@ -37,7 +37,7 @@ // The types and variables used locally //typedef int bool; typedef unsigned int uint; -#define SVP(S) ((S) ? S : "") +//#define SVP(S) ((S) ? S : "") #define _strlwr(P) strlwr(P) //OB: changed this line #define MAX_PATHNAME_LEN 256 #define N_CACHED_PROFILES 10 @@ -61,8 +61,8 @@ void htrc(char const *fmt, ...) } /* end of htrc */ #else // !TEST_MODULE // Normal included functions -extern int trace; -void htrc(char const *fmt, ...); +//extern int trace; +//void htrc(char const *fmt, ...); #endif // !TEST MODULE @@ -112,10 +112,11 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL}; //static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect"); -static const char hex[16] = "0123456789ABCDEF"; +static const char hex[17] = "0123456789ABCDEF"; BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry, - LPCSTR string, LPCSTR filename ); + LPCSTR string, LPCSTR filename); + /*********************************************************************** * PROFILE_CopyEntry * @@ -254,7 +255,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) PROFILESECTION* *next_section; PROFILEKEY *key, *prev_key, **next_key; - first_section = malloc(sizeof(*section)); + first_section = (PROFILESECTION*)malloc(sizeof(*section)); if (first_section == NULL) return NULL; @@ -281,7 +282,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) *p2 = '\0'; p++; - if (!(section = malloc(sizeof(*section) + strlen(p)))) + if (!(section = (PROFILESECTION*)malloc(sizeof(*section) + strlen(p)))) break; strcpy(section->name, p); @@ -319,13 +320,13 @@ static PROFILESECTION *PROFILE_Load( FILE *file ) } // endif p2 if (*p || !prev_key || *prev_key->name) { - if (!(key = malloc(sizeof(*key) + strlen(p)))) + if (!(key = (PROFILEKEY*)malloc(sizeof(*key) + strlen(p)))) break; strcpy(key->name, p); if (p2) { - key->value = malloc(strlen(p2)+1); + key->value = (char*)malloc(strlen(p2)+1); strcpy(key->value, p2); } else key->value = NULL; @@ -452,7 +453,7 @@ static BOOL PROFILE_Open(LPCSTR filename) /* First time around */ if (!CurProfile) for (i = 0; i < N_CACHED_PROFILES; i++) { - MRUProfile[i] = malloc(sizeof(PROFILE)); + MRUProfile[i] = (PROFILE*)malloc(sizeof(PROFILE)); if (MRUProfile[i] == NULL) break; @@ -520,7 +521,7 @@ static BOOL PROFILE_Open(LPCSTR filename) // strcpy(newdos_name, filename); // CurProfile->dos_name = newdos_name; - CurProfile->filename = malloc(strlen(filename) + 1); + CurProfile->filename = (char*)malloc(strlen(filename) + 1); strcpy(CurProfile->filename, filename); /* Try to open the profile file, first in $HOME/.wine */ @@ -783,7 +784,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, if (!create) return NULL; - if (!(*key = malloc(sizeof(PROFILEKEY) + strlen(key_name)))) + if (!(*key = (PROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name)))) return NULL; strcpy((*key)->name, key_name); @@ -798,7 +799,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, if (!create) return NULL; - *section = malloc(sizeof(PROFILESECTION) + strlen(section_name)); + *section = (PROFILESECTION*)malloc(sizeof(PROFILESECTION) + strlen(section_name)); if (*section == NULL) return NULL; @@ -806,7 +807,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section, strcpy((*section)->name, section_name); (*section)->next = NULL; - if (!((*section)->key = malloc(sizeof(PROFILEKEY) + strlen(key_name)))) { + if (!((*section)->key = (tagPROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name)))) { free(*section); return NULL; } // endif malloc @@ -1052,7 +1053,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name, } else if (trace > 1) htrc(" creating key\n" ); - key->value = malloc(strlen(value) + 1); + key->value = (char*)malloc(strlen(value) + 1); strcpy(key->value, value); CurProfile->changed = TRUE; } // endelse @@ -1125,7 +1126,7 @@ static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry, if (*p == ' ') { /* ouch, contained trailing ' ' */ int len = p - (LPSTR)def_val; - pDefVal = malloc(len + 1); + pDefVal = (LPSTR)malloc(len + 1); strncpy(pDefVal, def_val, len); pDefVal[len] = '\0'; } // endif *p @@ -1277,7 +1278,7 @@ BOOL WritePrivateProfileSection(LPCSTR section, ret = TRUE; while (*string) { - LPSTR buf = malloc(strlen(string) + 1); + LPSTR buf = (LPSTR)malloc(strlen(string) + 1); strcpy(buf, string); if ((p = strchr(buf, '='))) { diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 504ea837fee908018b9715fb2ceee798dd7b8df1..33af95a2bbc421e7de758310bc06eec17a333952 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -1505,23 +1505,16 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n, ml += g->More; if (ml > g->Sarea_Size) { -#if !defined(DEVELOPMENT) - if (trace) -#endif - htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size); - - free(g->Sarea); + FreeSarea(g); - if (!(g->Sarea = PlugAllocMem(g, ml))) { + if (AllocSarea(g, ml)) { char errmsg[MAX_STR]; snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); - g->Sarea_Size = 0; return true; - } // endif Alloc + } // endif SareaAlloc - g->Sarea_Size = ml; g->Createas = 0; g->Xchk = NULL; initid->max_length = rl; diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 08bb24e14dfb6f25d9a2c78d7f6de639a7cc3009..fe00f6a1eab007b0853769483538aad270f66596 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -933,8 +933,9 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM) ? fld->decimals : 0; - crp->Length = MY_MAX(fld->length, fld->max_length); - crp->Clen = GetTypeSize(crp->Type, crp->Length); + CHARSET_INFO *cs= get_charset(fld->charsetnr, MYF(0)); + crp->Clen = GetTypeSize(crp->Type, fld->length); + crp->Length = fld->length / (cs ? cs->mbmaxlen : 1); uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false; if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows, diff --git a/storage/connect/mysql-test/connect/disabled.def b/storage/connect/mysql-test/connect/disabled.def index 6d59369a4dfa94d1639e17f9bfb4289e0fecb71d..0dcf030613d062794a7d3614cda1fb10fbbe8311 100644 --- a/storage/connect/mysql-test/connect/disabled.def +++ b/storage/connect/mysql-test/connect/disabled.def @@ -19,3 +19,4 @@ json_java_3 : Need MongoDB running and its Java Driver installed mongo_c : Need MongoDB running and its C Driver installed mongo_java_2 : Need MongoDB running and its Java Driver installed mongo_java_3 : Need MongoDB running and its Java Driver installed +tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index 0a6507315db025609c07f5753ddc0d55c7db00ed..f669d64463733b51bf98dd2b7d2f675412063eae 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -334,7 +334,7 @@ PDBUSER PlgMakeUser(PGLOBAL g) { PDBUSER dbuserp; - if (!(dbuserp = (PDBUSER)PlugAllocMem(g, (uint)sizeof(DBUSERBLK)))) { + if (!(dbuserp = (PDBUSER)malloc(sizeof(DBUSERBLK)))) { sprintf(g->Message, MSG(MALLOC_ERROR), "PlgMakeUser"); return NULL; } // endif dbuserp diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index 0855e26570441fd5197f7e9bf1c2b1f746424fea..7b408870238715648f44619f05936606da138c73 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -138,7 +138,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) if (trace > 1) htrc("PlugInit: Language='%s'\n", - ((!Language) ? "Null" : (char*)Language)); + ((!Language) ? "Null" : (char*)Language)); try { g = new GLOBAL; @@ -160,13 +160,11 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize) /*******************************************************************/ /* Allocate the main work segment. */ /*******************************************************************/ - if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) { + if (worksize && AllocSarea(g, worksize)) { char errmsg[MAX_STR]; snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message); strcpy(g->Message, errmsg); - g->Sarea_Size = 0; - } else - g->Sarea_Size = worksize; + } // endif Sarea g->jump_level = -1; /* New setting to allow recursive call of Plug */ return(g); @@ -183,15 +181,7 @@ int PlugExit(PGLOBAL g) if (dup) free(dup); - if (g->Sarea) { -#if !defined(DEVELOPMENT) - if (trace) -#endif - htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size); - - free(g->Sarea); - } // endif Sarea - + FreeSarea(g); delete g; } // endif g @@ -459,30 +449,65 @@ short GetLineLength(PGLOBAL g) /***********************************************************************/ /* Program for memory allocation of work and language areas. */ /***********************************************************************/ -void *PlugAllocMem(PGLOBAL g, uint size) +bool AllocSarea(PGLOBAL g, uint size) { - void *areap; /* Pointer to allocated area */ - /*********************************************************************/ /* This is the allocation routine for the WIN32/UNIX/AIX version. */ /*********************************************************************/ - if (!(areap = malloc(size))) - sprintf(g->Message, MSG(MALLOC_ERROR), "malloc"); +#if defined(__WIN__) + if (size >= 1048576) // 1M + g->Sarea = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + else +#endif + g->Sarea = malloc(size); + + if (!g->Sarea) { + sprintf(g->Message, MSG(MALLOC_ERROR), "malloc"); + g->Sarea_Size = 0; + } else + g->Sarea_Size = size; #if defined(DEVELOPMENT) if (true) { #else if (trace) { #endif - if (areap) - htrc("Memory of %u allocated at %p\n", size, areap); + if (g->Sarea) + htrc("Work area of %u allocated at %p\n", size, g->Sarea); else - htrc("PlugAllocMem: %s\n", g->Message); + htrc("SareaAlloc: %s\n", g->Message); } // endif trace - return (areap); -} // end of PlugAllocMem + return (!g->Sarea); +} // end of AllocSarea + +/***********************************************************************/ +/* Program for memory freeing the work area. */ +/***********************************************************************/ +void FreeSarea(PGLOBAL g) +{ + if (g->Sarea) { +#if defined(__WIN__) + if (g->Sarea_Size >= 1048576) // 1M + VirtualFree(g->Sarea, 0, MEM_RELEASE); + else +#endif + free(g->Sarea); + +#if defined(DEVELOPMENT) + if (true) +#else + if (trace) +#endif + htrc("Freeing Sarea at %p size = %d\n", g->Sarea, g->Sarea_Size); + + g->Sarea = NULL; + g->Sarea_Size = 0; + } // endif Sarea + + return; +} // end of FreeSarea /***********************************************************************/ /* Program for SubSet initialization of memory pools. */ diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp index d3fb31fb57a6e6e24e57a67692bb21e423fd7755..7925e8f29a811b0e74a586e454621985612795f5 100644 --- a/storage/connect/tabtbl.cpp +++ b/storage/connect/tabtbl.cpp @@ -1,12 +1,9 @@ /************* TabTbl C++ Program Source Code File (.CPP) **************/ /* PROGRAM NAME: TABTBL */ /* ------------- */ -/* Version 1.8 */ +/* Version 1.9 */ /* */ -/* COPYRIGHT: */ -/* ---------- */ -/* (C) Copyright to PlugDB Software Development 2008-2017 */ -/* Author: Olivier BERTRAND */ +/* Author: Olivier BERTRAND 2008-2018 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -168,9 +165,14 @@ PTDB TBLDEF::GetTable(PGLOBAL g, MODE) { if (Catfunc == FNC_COL) return new(g) TDBTBC(this); - else if (Thread) - return new(g) TDBTBM(this); - else + else if (Thread) { +#if defined(DEVELOPMENT) + return new(g) TDBTBM(this); +#else + strcpy(g->Message, "Option THREAD is no more supported"); + return NULL; +#endif // DEVELOPMENT + } else return new(g) TDBTBL(this); } // end of GetTable @@ -560,6 +562,7 @@ void TBTBLK::ReadColumn(PGLOBAL) } // end of ReadColumn +#if defined(DEVELOPMENT) /* ------------------------- Class TDBTBM ---------------------------- */ /***********************************************************************/ @@ -650,7 +653,7 @@ bool TDBTBM::IsLocal(PTABLE tbp) return ((!stricmp(tdbp->Host, "localhost") || !strcmp(tdbp->Host, "127.0.0.1")) && - tdbp->Port == (int)GetDefaultPort()); + (int) tdbp->Port == (int)GetDefaultPort()); } // end of IsLocal /***********************************************************************/ @@ -865,5 +868,6 @@ int TDBTBM::ReadNextRemote(PGLOBAL g) return RC_OK; } // end of ReadNextRemote +#endif // DEVELOPMENT /* ------------------------------------------------------------------- */ diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h index f02bf620aae983e89fe2e77a8ae528dc2f8aba08..e7a84395787a7e0e55141ea21797038235906631 100644 --- a/storage/connect/tabtbl.h +++ b/storage/connect/tabtbl.h @@ -11,29 +11,8 @@ typedef class TBLDEF *PTBLDEF; typedef class TDBTBL *PTDBTBL; -typedef class TDBTBM *PTDBTBM; typedef class MYSQLC *PMYC; -/***********************************************************************/ -/* Defines the structures used for distributed TBM tables. */ -/***********************************************************************/ -typedef struct _TBMtable *PTBMT; - -typedef struct _TBMtable { - PTBMT Next; // Points to next data table struct - PTABLE Tap; // Points to the sub table - PGLOBAL G; // Needed in thread routine - bool Complete; // TRUE when all results are read - bool Ready; // TRUE when results are there - int Rows; // Total number of rows read so far - int ProgCur; // Current pos - int ProgMax; // Max pos - int Rc; // Return code - THD *Thd; - pthread_attr_t attr; // ??? - pthread_t Tid; // CheckOpen thread ID - } TBMT; - /***********************************************************************/ /* TBL table. */ /***********************************************************************/ @@ -123,7 +102,33 @@ class TBTBLK : public TIDBLK { protected: // Must not have additional members - }; // end of class TBTBLK +}; // end of class TBTBLK + +#if defined(DEVELOPMENT) +/***********************************************************************/ +/* This table type is buggy and removed until a fix is found. */ +/***********************************************************************/ +typedef class TDBTBM *PTDBTBM; + +/***********************************************************************/ +/* Defines the structures used for distributed TBM tables. */ +/***********************************************************************/ +typedef struct _TBMtable *PTBMT; + +typedef struct _TBMtable { + PTBMT Next; // Points to next data table struct + PTABLE Tap; // Points to the sub table + PGLOBAL G; // Needed in thread routine + bool Complete; // TRUE when all results are read + bool Ready; // TRUE when results are there + int Rows; // Total number of rows read so far + int ProgCur; // Current pos + int ProgMax; // Max pos + int Rc; // Return code + THD *Thd; + pthread_attr_t attr; // ??? + pthread_t Tid; // CheckOpen thread ID +} TBMT; /***********************************************************************/ /* This is the TBM Access Method class declaration. */ @@ -160,3 +165,4 @@ class DllExport TDBTBM : public TDBTBL { }; // end of class TDBTBM pthread_handler_t ThreadOpen(void *p); +#endif // DEVELOPMENT diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index 94d2c8ad5fdf37c27d624a4a3836a1832fb9bb9a..cb62667c0fe718c3ef5c0c06f13cd1f452687966 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -156,29 +156,20 @@ void user_connect::SetHandler(ha_connect *hc) bool user_connect::CheckCleanup(bool force) { if (thdp->query_id > last_query_id || force) { - uint worksize= GetWorkSize(); + uint worksize= GetWorkSize(), size = g->Sarea_Size; PlugCleanup(g, true); - if (g->Sarea_Size != worksize) { - if (g->Sarea) { -#if !defined(DEVELOPMENT) - if (trace) -#endif - htrc("CheckCleanup: Free Sarea at %p size=%d\n", - g->Sarea, g->Sarea_Size); - - free(g->Sarea); - } // endif Size + if (size != worksize) { + FreeSarea(g); // Check whether the work area could be allocated - if (!(g->Sarea = PlugAllocMem(g, worksize))) { - g->Sarea = PlugAllocMem(g, g->Sarea_Size); + if (AllocSarea(g, worksize)) { + AllocSarea(g, size); SetWorkSize(g->Sarea_Size); // Was too big - } else - g->Sarea_Size = worksize; // Ok + } // endif sarea - } // endif worksize + } // endif worksize PlugSubSet(g, g->Sarea, g->Sarea_Size); g->Xchk = NULL; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 85e41554efc0cb1af785f2d0ea831f33acfa7289..0e84546764d216208c74d3a51d89eefeaaf5e705 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2982,6 +2982,9 @@ int ha_federated::reset(void) } reset_dynamic(&results); + if (mysql) + mysql->net.thd= NULL; + return 0; } @@ -3202,12 +3205,14 @@ int ha_federated::real_query(const char *query, size_t length) int rc= 0; DBUG_ENTER("ha_federated::real_query"); - if (!mysql && (rc= real_connect())) + if (!query || !length) goto end; - if (!query || !length) + if (!mysql && (rc= real_connect())) goto end; + mysql->net.thd= table->in_use; + rc= mysql_real_query(mysql, query, (uint) length); end: diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index abf25abe0c5511f2f8a6acd57c32d5a743b304e4..f3af725862314c454a7a1e40b1ff45cdc114f6ee 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -169,7 +169,7 @@ class federatedx_io static void *operator new(size_t size, MEM_ROOT *mem_root) throw () { return alloc_root(mem_root, size); } static void operator delete(void *ptr, size_t size) - { TRASH(ptr, size); } + { TRASH_FREE(ptr, size); } virtual int query(const char *buffer, uint length)=0; virtual FEDERATEDX_IO_RESULT *store_result()=0; diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 970c503497f492de9f167a8c06a404a469681c5f..3513ddb4c2f38a2aa88461d5843fa54dc8e2a726 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -91,6 +91,15 @@ ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg) int ha_heap::open(const char *name, int mode, uint test_if_locked) { + if (table->s->reclength < sizeof (char*)) + { + MEM_UNDEFINED(table->s->default_values + table->s->reclength, + sizeof(char*) - table->s->reclength); + table->s->reclength= sizeof(char*); + MEM_UNDEFINED(table->record[0], table->s->reclength); + MEM_UNDEFINED(table->record[1], table->s->reclength); + } + internal_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE); if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT)) { diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index ad231236804325b5f34523a7653a5bc59fac7962..7eecefc90fdf5928f7e4c90742b8a9d7288f0961 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2017, Oracle 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 as published by @@ -520,3 +520,4 @@ MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE MODULE_OUTPUT_NAME ha_innodb LINK_LIBRARIES ${ZLIB_LIBRARY} ${LIBSYSTEMD} ${LINKER_SCRIPT}) +ADD_DEPENDENCIES(innobase GenError) diff --git a/storage/innobase/api/api0api.cc b/storage/innobase/api/api0api.cc index bc83e98374fe15a65d5909377a639088f505b0d6..fd14fdefd18fe6ed8bd6f8fb435a92c82c2a12c5 100644 --- a/storage/innobase/api/api0api.cc +++ b/storage/innobase/api/api0api.cc @@ -398,7 +398,7 @@ ib_read_tuple( data = btr_rec_copy_externally_stored_field( copy, offsets, zip_size, i, &len, - tuple->heap, NULL); + tuple->heap); ut_a(len != UNIV_SQL_NULL); } diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index bb010190af744b360c8c50d58cafeaf2ef8277eb..09d84d1ecbc76b45ef689f68755cb12b590c9549 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3792,8 +3792,7 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */ ulint mode1, /*!< in: search mode for range start */ const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */ - ulint mode2, /*!< in: search mode for range end */ - trx_t* trx) /*!< in: trx */ + ulint mode2) /*!< in: search mode for range end */ { btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS]; btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS]; @@ -3811,7 +3810,7 @@ btr_estimate_n_rows_in_range( table_n_rows = dict_table_get_n_rows(index->table); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); cursor.path_arr = path1; @@ -3833,7 +3832,7 @@ btr_estimate_n_rows_in_range( return (0); } - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); cursor.path_arr = path2; @@ -5466,8 +5465,7 @@ btr_copy_blob_prefix( ulint len, /*!< in: length of buf, in bytes */ ulint space_id,/*!< in: space id of the BLOB pages */ ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset, /*!< in: offset on the first BLOB page */ - trx_t* trx) /*!< in: transaction handle */ + ulint offset) /*!< in: offset on the first BLOB page */ { ulint copied_len = 0; @@ -5479,7 +5477,7 @@ btr_copy_blob_prefix( ulint part_len; ulint copy_len; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr); buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); @@ -5682,8 +5680,7 @@ btr_copy_externally_stored_field_prefix_low( zero for uncompressed BLOBs */ ulint space_id,/*!< in: space id of the first BLOB page */ ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset, /*!< in: offset on the first BLOB page */ - trx_t* trx) /*!< in: transaction handle */ + ulint offset) /*!< in: offset on the first BLOB page */ { if (UNIV_UNLIKELY(len == 0)) { return(0); @@ -5694,7 +5691,7 @@ btr_copy_externally_stored_field_prefix_low( space_id, page_no, offset)); } else { return(btr_copy_blob_prefix(buf, len, space_id, - page_no, offset, trx)); + page_no, offset)); } } @@ -5715,8 +5712,7 @@ btr_copy_externally_stored_field_prefix( field containing also the reference to the external part; must be protected by a lock or a page latch */ - ulint local_len,/*!< in: length of data, in bytes */ - trx_t* trx) /*!< in: transaction handle */ + ulint local_len)/*!< in: length of data, in bytes */ { ulint space_id; ulint page_no; @@ -5755,7 +5751,7 @@ btr_copy_externally_stored_field_prefix( len - local_len, zip_size, space_id, page_no, - offset, trx)); + offset)); } /*******************************************************************//** @@ -5774,8 +5770,7 @@ btr_copy_externally_stored_field( ulint zip_size,/*!< in: nonzero=compressed BLOB page size, zero for uncompressed BLOBs */ ulint local_len,/*!< in: length of data */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx) /*!< in: transaction handle */ + mem_heap_t* heap) /*!< in: mem heap */ { ulint space_id; ulint page_no; @@ -5806,8 +5801,7 @@ btr_copy_externally_stored_field( extern_len, zip_size, space_id, - page_no, offset, - trx); + page_no, offset); return(buf); } @@ -5826,8 +5820,7 @@ btr_rec_copy_externally_stored_field( zero for uncompressed BLOBs */ ulint no, /*!< in: field number */ ulint* len, /*!< out: length of the field */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx) /*!< in: transaction handle */ + mem_heap_t* heap) /*!< in: mem heap */ { ulint local_len; const byte* data; @@ -5858,7 +5851,6 @@ btr_rec_copy_externally_stored_field( } return(btr_copy_externally_stored_field(len, data, - zip_size, local_len, heap, - trx)); + zip_size, local_len, heap)); } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index ff80cfb29ad37ae8b584e13b389958cdd317126e..5ba9409a7b1c270a8e8f98eb8843d9e2cd9f7572 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -496,7 +496,7 @@ btr_pcur_move_backward_from_page( mtr_commit(mtr); - mtr_start_trx(mtr, mtr->trx); + mtr_start(mtr); btr_pcur_restore_position(latch_mode2, cursor, mtr); diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index f2ab73217e01a4ebb98ee9d47e4a96d928cb192a..7a441b4239af25a73667e43cb0f2ebee7fae59a8 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -649,7 +650,7 @@ buf_buddy_free_low( buf_pool->buddy_stat[i].used--; recombine: - UNIV_MEM_ASSERT_AND_ALLOC(buf, BUF_BUDDY_LOW << i); + UNIV_MEM_ALLOC(buf, BUF_BUDDY_LOW << i); if (i == BUF_BUDDY_SIZES) { buf_buddy_block_free(buf_pool, buf); diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index 703c425e127dc21859fe955bad7cb03a4bd24ad8..793d6cdd68eacde2d5ebfb5dca7904b7c6e957fb 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -613,6 +613,7 @@ buf_load() if (dump_n == 0) { ut_free(dump); + ut_free(dump_tmp); ut_sprintf_timestamp(now); buf_load_status(STATUS_NOTICE, "Buffer pool(s) load completed at %s " diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index a047b28f4fd08c59450b1e29f70a608b3d5a0425..9e89a291c80082a415b6baaa6b6fd0f0e6123b41 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -90,6 +90,10 @@ during LRU eviction. */ frames in the buffer pool, we set this to TRUE */ static ibool buf_lru_switched_on_innodb_mon = FALSE; +/** True if diagnostic message about difficult to find free blocks +in the buffer bool has already printed. */ +static bool buf_lru_free_blocks_error_printed; + /******************************************************************//** These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O and page_zip_decompress() operations. Based on the statistics, @@ -1045,8 +1049,6 @@ buf_LRU_get_free_block( ibool freed = FALSE; ulint n_iterations = 0; ulint flush_failures = 0; - ibool mon_value_was = FALSE; - ibool started_monitor = FALSE; MONITOR_INC(MONITOR_LRU_GET_FREE_SEARCH); loop: @@ -1054,6 +1056,11 @@ buf_LRU_get_free_block( buf_LRU_check_size_of_non_data_objects(buf_pool); + DBUG_EXECUTE_IF("ib_lru_force_no_free_page", + if (!buf_lru_free_blocks_error_printed) { + n_iterations = 21; + goto not_found;}); + /* If there is a block in the free list, take it */ block = buf_LRU_get_free_only(buf_pool); @@ -1062,16 +1069,11 @@ buf_LRU_get_free_block( buf_pool_mutex_exit(buf_pool); ut_ad(buf_pool_from_block(block) == buf_pool); memset(&block->page.zip, 0, sizeof block->page.zip); - - if (started_monitor) { - srv_print_innodb_monitor = - static_cast(mon_value_was); - } - return(block); } freed = FALSE; + if (buf_pool->try_LRU_scan || n_iterations > 0) { /* If no block was in the free list, search from the end of the LRU list and try to free a block there. @@ -1094,6 +1096,10 @@ buf_LRU_get_free_block( } } +#ifndef DBUG_OFF +not_found: +#endif + buf_pool_mutex_exit(buf_pool); if (freed) { @@ -1101,40 +1107,26 @@ buf_LRU_get_free_block( } - if (n_iterations > 20) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Warning: difficult to find free blocks in\n" - "InnoDB: the buffer pool (%lu search iterations)!\n" - "InnoDB: %lu failed attempts to flush a page!" - " Consider\n" - "InnoDB: increasing the buffer pool size.\n" - "InnoDB: It is also possible that" - " in your Unix version\n" - "InnoDB: fsync is very slow, or" - " completely frozen inside\n" - "InnoDB: the OS kernel. Then upgrading to" - " a newer version\n" - "InnoDB: of your operating system may help." - " Look at the\n" - "InnoDB: number of fsyncs in diagnostic info below.\n" - "InnoDB: Pending flushes (fsync) log: %lu;" - " buffer pool: %lu\n" - "InnoDB: %lu OS file reads, %lu OS file writes," - " %lu OS fsyncs\n" - "InnoDB: Starting InnoDB Monitor to print further\n" - "InnoDB: diagnostics to the standard output.\n", - (ulong) n_iterations, - (ulong) flush_failures, - (ulong) fil_n_pending_log_flushes, - (ulong) fil_n_pending_tablespace_flushes, - (ulong) os_n_file_reads, (ulong) os_n_file_writes, - (ulong) os_n_fsyncs); - - mon_value_was = srv_print_innodb_monitor; - started_monitor = TRUE; - srv_print_innodb_monitor = TRUE; - os_event_set(srv_monitor_event); + if (n_iterations > 20 && !buf_lru_free_blocks_error_printed) { + ib_logf(IB_LOG_LEVEL_WARN, + "Difficult to find free blocks in" + " the buffer pool (" ULINTPF " search iterations)! " + ULINTPF " failed attempts to flush a page!", + n_iterations, flush_failures); + ib_logf(IB_LOG_LEVEL_INFO, + "Consider increasing the buffer pool size."); + ib_logf(IB_LOG_LEVEL_INFO, + "Pending flushes (fsync) log: " ULINTPF + " buffer pool: " ULINTPF + " OS file reads: " ULINTPF " OS file writes: " + ULINTPF " OS fsyncs: " ULINTPF "", + fil_n_pending_log_flushes, + fil_n_pending_tablespace_flushes, + os_n_file_reads, + os_n_file_writes, + os_n_fsyncs); + + buf_lru_free_blocks_error_printed = true; } /* If we have scanned the whole LRU and still are unable to @@ -1916,8 +1908,7 @@ buf_LRU_block_free_non_file_page( UT_LIST_ADD_FIRST(list, buf_pool->free, (&block->page)); ut_d(block->page.in_free_list = TRUE); - - UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE); + UNIV_MEM_FREE(block->frame, UNIV_PAGE_SIZE); } /******************************************************************//** diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index 0b9e08544a5c4d33b4ddcde4049b68838db86f6c..34ca399f9b2ad99583f22b7a2c8f6b7cadd0c0cc 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -49,8 +50,10 @@ ulint dtype_get_at_most_n_mbchars( /*========================*/ ulint prtype, /*!< in: precise type */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multi-byte character */ + ulint mbminlen, /*!< in: minimum length of + a multi-byte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of + a multi-byte character, in bytes */ ulint prefix_len, /*!< in: length of the requested prefix, in characters, multiplied by dtype_get_mbmaxlen(dtype) */ @@ -58,9 +61,6 @@ dtype_get_at_most_n_mbchars( const char* str) /*!< in: the string whose prefix length is being determined */ { - ulint mbminlen = DATA_MBMINLEN(mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(mbminmaxlen); - ut_a(data_len != UNIV_SQL_NULL); ut_ad(!mbmaxlen || !(prefix_len % mbmaxlen)); diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 8d7c1275c3b11c01be2ffdd5aef788c7554d954a..7ec4364becc24046e82a9f67c924202203c63e49 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -3398,6 +3398,7 @@ dict_foreign_find_index( if (types_idx != index && !(index->type & DICT_FTS) && !index->to_be_dropped + && !dict_index_is_online_ddl(index) && dict_foreign_qualify_index( table, col_names, columns, n_cols, index, types_idx, diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 0e5e9f65b043eefc8af09ba7e0975a0101a53774..dd8155c09eb72f60b1421cd7813bfbe8c802f0ed 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -319,8 +319,8 @@ dict_mem_table_col_rename_low( ut_ad(from_len <= NAME_LEN); ut_ad(to_len <= NAME_LEN); - char from[NAME_LEN]; - strncpy(from, s, NAME_LEN); + char from[NAME_LEN + 1]; + strncpy(from, s, NAME_LEN + 1); if (from_len == to_len) { /* The easy case: simply replace the column name in @@ -532,7 +532,8 @@ dict_mem_fill_column_struct( column->len = (unsigned int) col_len; #ifndef UNIV_HOTBACKUP dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen); - dict_col_set_mbminmaxlen(column, mbminlen, mbmaxlen); + column->mbminlen = mbminlen; + column->mbmaxlen = mbmaxlen; #endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index c9ecf3dab0b1fc763d9e1ed9fb68596be6f3eacd..b4102e48628c63a07bb655ded614a4c380b3971d 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2074,7 +2074,7 @@ fil_write_flushed_lsn( { byte* buf1; byte* buf; - dberr_t err; + dberr_t err = DB_TABLESPACE_NOT_FOUND; buf1 = static_cast(ut_malloc(2 * UNIV_PAGE_SIZE)); buf = static_cast(ut_align(buf1, UNIV_PAGE_SIZE)); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 2ba58c9a590fb674e427d22de3d27cc6e5d398af..dc121083c6e29198cd72642dfd42cdff7a8812cf 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2001,7 +2001,7 @@ fts_create_one_index_table( ? DATA_VARCHAR : DATA_VARMYSQL, field->col->prtype, FTS_MAX_WORD_LEN_IN_CHAR - * DATA_MBMAXLEN(field->col->mbminmaxlen)); + * field->col->mbmaxlen); dict_mem_table_add_col(new_table, heap, "first_doc_id", DATA_INT, DATA_NOT_NULL | DATA_UNSIGNED, @@ -3362,8 +3362,7 @@ fts_fetch_doc_from_rec( dict_table_zip_size(table), clust_pos, &doc->text.f_len, static_cast( - doc->self_heap->arg), - NULL); + doc->self_heap->arg)); } else { doc->text.f_str = (byte*) rec_get_nth_field( clust_rec, offsets, clust_pos, @@ -4762,9 +4761,17 @@ fts_process_token( t_str.f_str = static_cast( mem_heap_alloc(heap, t_str.f_len)); - newlen = innobase_fts_casedn_str( - doc->charset, (char*) str.f_str, str.f_len, - (char*) t_str.f_str, t_str.f_len); + /* For binary collations, a case sensitive search is + performed. Hence don't convert to lower case. */ + if (my_binary_compare(result_doc->charset)) { + memcpy(t_str.f_str, str.f_str, str.f_len); + t_str.f_str[str.f_len]= 0; + newlen= str.f_len; + } else { + newlen = innobase_fts_casedn_str( + doc->charset, (char*) str.f_str, str.f_len, + (char*) t_str.f_str, t_str.f_len); + } t_str.f_len = newlen; t_str.f_str[newlen] = 0; @@ -7592,8 +7599,7 @@ fts_init_recover_doc( &doc.text.f_len, static_cast(dfield_get_data(dfield)), zip_size, len, - static_cast(doc.self_heap->arg), - NULL); + static_cast(doc.self_heap->arg)); } else { doc.text.f_str = static_cast( dfield_get_data(dfield)); diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index b874309964b4c6c979cb676684330bb310941cd9..3a54383683749f29e41454602dcc2c7713c1394d 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -1917,8 +1917,7 @@ fts_query_fetch_document( if (dfield_is_ext(dfield)) { data = btr_copy_externally_stored_field( &cur_len, data, phrase->zip_size, - dfield_get_len(dfield), phrase->heap, - NULL); + dfield_get_len(dfield), phrase->heap); } else { cur_len = dfield_get_len(dfield); } @@ -3763,10 +3762,19 @@ fts_query_str_preprocess( str_len = query_len * charset->casedn_multiply + 1; str_ptr = static_cast(ut_malloc(str_len)); - *result_len = innobase_fts_casedn_str( - charset, const_cast(reinterpret_cast( - query_str)), query_len, - reinterpret_cast(str_ptr), str_len); + /* For binary collations, a case sensitive search is + performed. Hence don't convert to lower case. */ + if (my_binary_compare(charset)) { + memcpy(str_ptr, query_str, query_len); + str_ptr[query_len]= 0; + *result_len= query_len; + } else { + *result_len = innobase_fts_casedn_str( + charset, const_cast + (reinterpret_cast( query_str)), + query_len, + reinterpret_cast(str_ptr), str_len); + } ut_ad(*result_len < str_len); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a45b63d015940935dfed9e948e8fcee0245fd411..b66f74873a92d5b7152ebbc8885c8fc73b66e85a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3094,13 +3094,13 @@ innobase_convert_identifier( ibool file_id)/*!< in: TRUE=id is a table or database name; FALSE=id is an UTF-8 string */ { + char nz2[MAX_TABLE_NAME_LEN + 1]; const char* s = id; int q; if (file_id) { char nz[MAX_TABLE_NAME_LEN + 1]; - char nz2[MAX_TABLE_NAME_LEN + 1]; /* Decode the table name. The MySQL function expects a NUL-terminated string. The input and output strings @@ -13109,7 +13109,7 @@ ha_innobase::records_in_range( n_rows = btr_estimate_n_rows_in_range(index, range_start, mode1, range_end, - mode2, prebuilt->trx); + mode2); } else { n_rows = HA_POS_ERROR; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index bdc4987b5c9896e7f666197c995818ebf1caa17d..f8e61631dfe5cdb921d0cccffc352f031142e8df 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -1197,8 +1197,7 @@ innobase_col_to_mysql( #ifdef UNIV_DEBUG case DATA_MYSQL: ut_ad(flen >= len); - ut_ad(DATA_MBMAXLEN(col->mbminmaxlen) - >= DATA_MBMINLEN(col->mbminmaxlen)); + ut_ad(col->mbmaxlen >= col->mbminlen); memcpy(dest, data, len); break; diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index c621ed5f71a94237364822646f96b79d26bd17db..2b406e116b0ffd83ac62a5fe21a875166b92e1e1 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2018, 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 @@ -4603,7 +4603,7 @@ ibuf_merge_or_delete_for_page( function. When the counter is > 0, that prevents tablespace from being dropped. */ - space = fil_space_acquire(space_id); + space = fil_space_acquire_silent(space_id); if (UNIV_UNLIKELY(!space)) { /* Do not try to read the bitmap page from space; diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 30010da9d8f7663809eccaac70c8dfab1efacd84..51ff300fa1f3c1f6dae204d12bca726e12d3940c 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -566,8 +566,7 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */ ulint mode1, /*!< in: search mode for range start */ const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */ - ulint mode2, /*!< in: search mode for range end */ - trx_t* trx); /*!< in: trx */ + ulint mode2); /*!< in: search mode for range end */ /*******************************************************************//** Estimates the number of different key values in a given index, for each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index). @@ -703,8 +702,7 @@ btr_copy_externally_stored_field_prefix( field containing also the reference to the external part; must be protected by a lock or a page latch */ - ulint local_len,/*!< in: length of data, in bytes */ - trx_t* trx); /*!< in: transaction handle */ + ulint local_len);/*!< in: length of data, in bytes */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. The clustered index record must be protected by a lock or a page latch. @@ -721,8 +719,7 @@ btr_copy_externally_stored_field( ulint zip_size,/*!< in: nonzero=compressed BLOB page size, zero for uncompressed BLOBs */ ulint local_len,/*!< in: length of data */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx); /*!< in: transaction handle */ + mem_heap_t* heap); /*!< in: mem heap */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. @return the field copied to heap, or NULL if the field is incomplete */ @@ -737,8 +734,7 @@ btr_rec_copy_externally_stored_field( zero for uncompressed BLOBs */ ulint no, /*!< in: field number */ ulint* len, /*!< out: length of the field */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx); /*!< in: transaction handle */ + mem_heap_t* heap); /*!< in: mem heap */ /*******************************************************************//** Flags the data tuple fields that are marked as extern storage in the update vector. We use this function to remember which fields we must diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index 111664b0b527f6c79d99bb9568101426a836a31f..28182782105b7723de3781e4b258d399d193ee7d 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -181,18 +182,7 @@ store the charset-collation number; one byte is left unused, though */ #define DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE 6 /* Maximum multi-byte character length in bytes, plus 1 */ -#define DATA_MBMAX 5 - -/* Pack mbminlen, mbmaxlen to mbminmaxlen. */ -#define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \ - ((mbmaxlen) * DATA_MBMAX + (mbminlen)) -/* Get mbminlen from mbminmaxlen. Cast the result of UNIV_EXPECT to ulint -because in GCC it returns a long. */ -#define DATA_MBMINLEN(mbminmaxlen) ((ulint) \ - UNIV_EXPECT(((mbminmaxlen) % DATA_MBMAX), \ - 1)) -/* Get mbmaxlen from mbminmaxlen. */ -#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX)) +#define DATA_MBMAX 8 /* We now support 15 bits (up to 32767) collation number */ #define MAX_CHAR_COLL_NUM 32767 @@ -219,8 +209,10 @@ ulint dtype_get_at_most_n_mbchars( /*========================*/ ulint prtype, /*!< in: precise type */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multi-byte character */ + ulint mbminlen, /*!< in: minimum length of + a multi-byte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of + a multi-byte character, in bytes */ ulint prefix_len, /*!< in: length of the requested prefix, in characters, multiplied by dtype_get_mbmaxlen(dtype) */ @@ -365,19 +357,6 @@ dtype_get_mbmaxlen( /*===============*/ const dtype_t* type); /*!< in: type */ /*********************************************************************//** -Sets the minimum and maximum length of a character, in bytes. */ -UNIV_INLINE -void -dtype_set_mbminmaxlen( -/*==================*/ - dtype_t* type, /*!< in/out: type */ - ulint mbminlen, /*!< in: minimum length of a char, - in bytes, or 0 if this is not - a character type */ - ulint mbmaxlen); /*!< in: maximum length of a char, - in bytes, or 0 if this is not - a character type */ -/*********************************************************************//** Gets the padding character code for the type. @return padding character code, or ULINT_UNDEFINED if no padding specified */ UNIV_INLINE @@ -397,7 +376,9 @@ dtype_get_fixed_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of a + ulint mbminlen, /*!< in: minimum length of a + multibyte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of a multibyte character, in bytes */ ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */ #ifndef UNIV_HOTBACKUP @@ -411,8 +392,8 @@ dtype_get_min_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen); /*!< in: minimum and maximum length of a - multibyte character */ + ulint mbminlen, /*!< in: minimum length of a character */ + ulint mbmaxlen); /*!< in: maximum length of a character */ /***********************************************************************//** Returns the maximum size of a data type. Note: types in system tables may be incomplete and return incorrect information. @@ -529,11 +510,10 @@ struct dtype_t{ the string, MySQL uses 1 or 2 bytes to store the string length) */ #ifndef UNIV_HOTBACKUP - unsigned mbminmaxlen:5; /*!< minimum and maximum length of a - character, in bytes; - DATA_MBMINMAXLEN(mbminlen,mbmaxlen); - mbminlen=DATA_MBMINLEN(mbminmaxlen); - mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ + unsigned mbminlen:3; /*!< minimum length of a character, + in bytes */ + unsigned mbmaxlen:3; /*!< maximum length of a character, + in bytes */ #endif /* !UNIV_HOTBACKUP */ }; diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index bf433036e61bbe412abaa9da2c9870380c65e313..eaa90f6d33acf0a4a98a2be8691dc33e330effdf 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -103,27 +103,6 @@ dtype_get_mblen( } } -/*********************************************************************//** -Sets the minimum and maximum length of a character, in bytes. */ -UNIV_INLINE -void -dtype_set_mbminmaxlen( -/*==================*/ - dtype_t* type, /*!< in/out: type */ - ulint mbminlen, /*!< in: minimum length of a char, - in bytes, or 0 if this is not - a character type */ - ulint mbmaxlen) /*!< in: maximum length of a char, - in bytes, or 0 if this is not - a character type */ -{ - ut_ad(mbminlen < DATA_MBMAX); - ut_ad(mbmaxlen < DATA_MBMAX); - ut_ad(mbminlen <= mbmaxlen); - - type->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen); -} - /*********************************************************************//** Compute the mbminlen and mbmaxlen members of a data type structure. */ UNIV_INLINE @@ -136,7 +115,8 @@ dtype_set_mblen( ulint mbmaxlen; dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen); - dtype_set_mbminmaxlen(type, mbminlen, mbmaxlen); + type->mbminlen = mbminlen; + type->mbmaxlen = mbmaxlen; ut_ad(dtype_validate(type)); } @@ -232,8 +212,7 @@ dtype_get_mbminlen( /*===============*/ const dtype_t* type) /*!< in: type */ { - ut_ad(type); - return(DATA_MBMINLEN(type->mbminmaxlen)); + return type->mbminlen; } /*********************************************************************//** Gets the maximum length of a character, in bytes. @@ -245,8 +224,7 @@ dtype_get_mbmaxlen( /*===============*/ const dtype_t* type) /*!< in: type */ { - ut_ad(type); - return(DATA_MBMAXLEN(type->mbminmaxlen)); + return type->mbmaxlen; } /*********************************************************************//** @@ -522,8 +500,10 @@ dtype_get_fixed_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multibyte character, in bytes */ + ulint mbminlen, /*!< in: minimum length of a + multibyte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of a + multibyte character, in bytes */ ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ { switch (mtype) { @@ -564,11 +544,10 @@ dtype_get_fixed_size_low( dtype_get_charset_coll(prtype), &i_mbminlen, &i_mbmaxlen); - ut_ad(DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen) - == mbminmaxlen); + ut_ad(i_mbminlen == mbminlen); + ut_ad(i_mbmaxlen == mbmaxlen); #endif /* UNIV_DEBUG */ - if (DATA_MBMINLEN(mbminmaxlen) - == DATA_MBMAXLEN(mbminmaxlen)) { + if (mbminlen == mbmaxlen) { return(len); } } @@ -601,8 +580,8 @@ dtype_get_min_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen) /*!< in: minimum and maximum length of a - multi-byte character */ + ulint mbminlen, /*!< in: minimum length of a character */ + ulint mbmaxlen) /*!< in: maximum length of a character */ { switch (mtype) { case DATA_SYS: @@ -632,9 +611,6 @@ dtype_get_min_size_low( if (prtype & DATA_BINARY_TYPE) { return(len); } else { - ulint mbminlen = DATA_MBMINLEN(mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(mbminmaxlen); - if (mbminlen == mbmaxlen) { return(len); } @@ -705,9 +681,9 @@ dtype_get_sql_null_size( { #ifndef UNIV_HOTBACKUP return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, - type->mbminmaxlen, comp)); + type->mbminlen, type->mbmaxlen, comp)); #else /* !UNIV_HOTBACKUP */ return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, - 0, 0)); + 0, 0, 0)); #endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 0d5ade1631e55160167d0cfafdb7fbe3a6edd3b8..7011f4a9226d1c8d06756668289baa51e0e6240d 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -197,18 +197,6 @@ dict_col_get_mbmaxlen( const dict_col_t* col) /*!< in: column */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** -Sets the minimum and maximum number of bytes per character. */ -UNIV_INLINE -void -dict_col_set_mbminmaxlen( -/*=====================*/ - dict_col_t* col, /*!< in/out: column */ - ulint mbminlen, /*!< in: minimum multi-byte - character size, in bytes */ - ulint mbmaxlen) /*!< in: minimum multi-byte - character size, in bytes */ - MY_ATTRIBUTE((nonnull)); -/*********************************************************************//** Gets the column data type. */ UNIV_INLINE void diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 22b96a58f66ec3f4f6378a0e039bbb665a6cd711..bc72d44108169526fa20dc1d53596f77298d45ec 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -41,7 +41,7 @@ dict_col_get_mbminlen( /*==================*/ const dict_col_t* col) /*!< in: column */ { - return(DATA_MBMINLEN(col->mbminmaxlen)); + return col->mbminlen; } /*********************************************************************//** Gets the maximum number of bytes per character. @@ -52,25 +52,7 @@ dict_col_get_mbmaxlen( /*==================*/ const dict_col_t* col) /*!< in: column */ { - return(DATA_MBMAXLEN(col->mbminmaxlen)); -} -/*********************************************************************//** -Sets the minimum and maximum number of bytes per character. */ -UNIV_INLINE -void -dict_col_set_mbminmaxlen( -/*=====================*/ - dict_col_t* col, /*!< in/out: column */ - ulint mbminlen, /*!< in: minimum multi-byte - character size, in bytes */ - ulint mbmaxlen) /*!< in: minimum multi-byte - character size, in bytes */ -{ - ut_ad(mbminlen < DATA_MBMAX); - ut_ad(mbmaxlen < DATA_MBMAX); - ut_ad(mbminlen <= mbmaxlen); - - col->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen); + return col->mbmaxlen; } /*********************************************************************//** Gets the column data type. */ @@ -87,7 +69,8 @@ dict_col_copy_type( type->mtype = col->mtype; type->prtype = col->prtype; type->len = col->len; - type->mbminmaxlen = col->mbminmaxlen; + type->mbminlen = col->mbminlen; + type->mbmaxlen = col->mbmaxlen; } #endif /* !UNIV_HOTBACKUP */ @@ -109,7 +92,8 @@ dict_col_type_assert_equal( ut_ad(col->prtype == type->prtype); //ut_ad(col->len == type->len); # ifndef UNIV_HOTBACKUP - ut_ad(col->mbminmaxlen == type->mbminmaxlen); + ut_ad(col->mbminlen == type->mbminlen); + ut_ad(col->mbmaxlen == type->mbmaxlen); # endif /* !UNIV_HOTBACKUP */ return(TRUE); @@ -127,7 +111,7 @@ dict_col_get_min_size( const dict_col_t* col) /*!< in: column */ { return(dtype_get_min_size_low(col->mtype, col->prtype, col->len, - col->mbminmaxlen)); + col->mbminlen, col->mbmaxlen)); } /***********************************************************************//** Returns the maximum size of the column. @@ -152,7 +136,7 @@ dict_col_get_fixed_size( ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ { return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len, - col->mbminmaxlen, comp)); + col->mbminlen, col->mbmaxlen, comp)); } /***********************************************************************//** Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 9a6cc0aa0c19c8e4a31354799d719cac73621ccd..3c9bd80431ec45435323f99b9999bbd72ed5b7fc 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -526,11 +526,10 @@ struct dict_col_t{ the string, MySQL uses 1 or 2 bytes to store the string length) */ - unsigned mbminmaxlen:5; /*!< minimum and maximum length of a - character, in bytes; - DATA_MBMINMAXLEN(mbminlen,mbmaxlen); - mbminlen=DATA_MBMINLEN(mbminmaxlen); - mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ + unsigned mbminlen:3; /*!< minimum length of a + character, in bytes */ + unsigned mbmaxlen:3; /*!< maximum length of a + character, in bytes */ /*----------------------*/ /* End of definitions copied from dtype_t */ /* @} */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 81f207d1e2096ee3f550ed2042141c3b2ec2478a..312b09e1f2d9abacdbbf6965ac538b9b6497bbe9 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 diff --git a/storage/innobase/include/log0crypt.h b/storage/innobase/include/log0crypt.h index 0ad7e7d7037a92cf08c6295c55aa9d8cd35aa4a5..b7a221e0a8172892a13bd349d5f1d1067b5da1ce 100644 --- a/storage/innobase/include/log0crypt.h +++ b/storage/innobase/include/log0crypt.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2018, 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 @@ -73,6 +73,8 @@ log_encrypt_before_write( /*=====================*/ ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */ byte* block, /*!< in/out: pointer to a log block */ + lsn_t lsn, /*!< in: log sequence number of + the start of the buffer */ const ulint size); /*!< in: size of log blocks */ /******************************************************** @@ -83,6 +85,8 @@ void log_decrypt_after_read( /*===================*/ byte* frame, /*!< in/out: log segment */ + lsn_t lsn, /*!< in: log sequence number of the start + of the buffer */ const ulint size); /*!< in: log segment size */ /* Error codes for crypt info */ diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 63e68150b61da7235e2cf95099563e442343a247..2b4638718fd11770488d4ecb8408aa6e66c12ede 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -305,8 +305,8 @@ mem_heap_free_heap_top( mem_block_set_free(block, old_top - (byte*) block); ut_ad(mem_block_get_start(block) <= mem_block_get_free(block)); - UNIV_MEM_ASSERT_W(old_top, (byte*) block + block->len - old_top); #if defined UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(old_top, (byte*)block + block->len - old_top); /* In the debug version erase block from top up */ mem_erase_buf(old_top, (byte*) block + block->len - old_top); @@ -315,7 +315,7 @@ mem_heap_free_heap_top( mem_current_allocated_memory -= (total_size - size); mutex_exit(&mem_hash_mutex); #endif /* UNIV_MEM_DEBUG */ - UNIV_MEM_ALLOC(old_top, (byte*) block + block->len - old_top); + UNIV_MEM_FREE(old_top, (byte*)block + block->len - old_top); /* If free == start, we may free the block if it is not the first one */ @@ -396,11 +396,11 @@ mem_heap_free_top( /* Subtract the free field of block */ mem_block_set_free(block, mem_block_get_free(block) - MEM_SPACE_NEEDED(n)); - UNIV_MEM_ASSERT_W((byte*) block + mem_block_get_free(block), n); #ifdef UNIV_MEM_DEBUG ut_ad(mem_block_get_start(block) <= mem_block_get_free(block)); + UNIV_MEM_ALLOC((byte*) block + mem_block_get_free(block), n); /* In the debug version check the consistency, and erase field */ mem_field_erase((byte*) block + mem_block_get_free(block), n); #endif @@ -412,11 +412,7 @@ mem_heap_free_top( == mem_block_get_start(block))) { mem_heap_block_free(heap, block); } else { - /* Avoid a bogus UNIV_MEM_ASSERT_W() warning in a - subsequent invocation of mem_heap_free_top(). - Originally, this was UNIV_MEM_FREE(), to catch writes - to freed memory. */ - UNIV_MEM_ALLOC((byte*) block + mem_block_get_free(block), n); + UNIV_MEM_FREE((byte*) block + mem_block_get_free(block), n); } } diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index c3307985532b3f29895742917ae6b49759086944..1df9fba5e9ede0be487db04ac114ae8c9a14156a 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -36,7 +36,6 @@ Created 11/26/1995 Heikki Tuuri #include "ut0byte.h" #include "mtr0types.h" #include "page0types.h" -#include "trx0types.h" /* Logging modes for a mini-transaction */ #define MTR_LOG_ALL 21 /* default mode: log all operations @@ -210,15 +209,6 @@ functions). The page number parameter was originally written as 0. @{ */ /* included here because it needs MLOG_LSN defined */ #include "log0log.h" -/***************************************************************//** -Starts a mini-transaction. */ -UNIV_INLINE -void -mtr_start_trx( -/*======*/ - mtr_t* mtr, /*!< out: mini-transaction */ - trx_t* trx) /*!< in: transaction */ - MY_ATTRIBUTE((nonnull (1))); /***************************************************************//** Starts a mini-transaction. */ UNIV_INLINE @@ -226,10 +216,7 @@ void mtr_start( /*======*/ mtr_t* mtr) /*!< out: mini-transaction */ -{ - mtr_start_trx(mtr, NULL); -} - MY_ATTRIBUTE((nonnull)) + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Commits a mini-transaction. */ UNIV_INTERN @@ -437,7 +424,6 @@ struct mtr_t{ #ifdef UNIV_DEBUG ulint magic_n; #endif /* UNIV_DEBUG */ - trx_t* trx; /*!< transaction */ }; #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index 37cea34d4eb12268b7a79a565eb42bb921f55666..3f897ae1d101d94edc687d043af474532f8e7410 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -43,10 +43,9 @@ mtr_block_dirtied( Starts a mini-transaction. */ UNIV_INLINE void -mtr_start_trx( +mtr_start( /*======*/ - mtr_t* mtr, /*!< out: mini-transaction */ - trx_t* trx) /*!< in: transaction */ + mtr_t* mtr) /*!< out: mini-transaction */ { UNIV_MEM_INVALID(mtr, sizeof *mtr); @@ -59,7 +58,6 @@ mtr_start_trx( mtr->made_dirty = FALSE; mtr->n_log_recs = 0; mtr->n_freed_pages = 0; - mtr->trx = trx; ut_d(mtr->state = MTR_ACTIVE); ut_d(mtr->magic_n = MTR_MAGIC_N); diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic index 5811a77a48b765b16d2f77162b3abc261e52aee5..89f6902059dcb63f66e7e33ad9cfb136095cd073 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -922,7 +923,7 @@ rec_offs_set_n_alloc( { ut_ad(offsets); ut_ad(n_alloc > REC_OFFS_HEADER_SIZE); - UNIV_MEM_ASSERT_AND_ALLOC(offsets, n_alloc * sizeof *offsets); + UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets); offsets[0] = n_alloc; } diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 71e3b9bb19e8de72866b4c63dc37107cc2ab4191..a38e9b6b3d559c4fa39d730f3a29c3bdb394c3a1 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -589,18 +589,6 @@ void row_mysql_close(void); /*=================*/ -/*********************************************************************//** -Reassigns the table identifier of a table. -@return error code or DB_SUCCESS */ -UNIV_INTERN -dberr_t -row_mysql_table_id_reassign( -/*========================*/ - dict_table_t* table, /*!< in/out: table */ - trx_t* trx, /*!< in/out: transaction */ - table_id_t* new_id) /*!< out: new table id */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); - /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. This template struct is used to speed up row transformations between diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 630818a8648d59da86686dd617abb1b753a5761e..ec15250ec7b7eb00e23884ee40b6e283b2b1f176 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -196,6 +196,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 42ac62916e0330c6a7bc975692c80b5a17b34b73..266ca32548c5cefd869003271e812a2c8dfb5292 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -246,13 +246,22 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end( +trx_undo_truncate_end_func( /*=======================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction whose undo log it is */ +#endif /* UNIV_DEBUG */ trx_undo_t* undo, /*!< in/out: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ MY_ATTRIBUTE((nonnull)); +#ifdef UNIV_DEBUG +# define trx_undo_truncate_end(trx,undo,limit) \ + trx_undo_truncate_end_func(trx,undo,limit) +#else /* UNIV_DEBUG */ +# define trx_undo_truncate_end(trx,undo,limit) \ + trx_undo_truncate_end_func(undo,limit) +#endif /* UNIV_DEBUG */ /***********************************************************************//** Truncates an undo log from the start. This function is used during a purge diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index f00cb179f56990653564f8e7cf0b7b7b3607089f..24bcab56870dc8406efe48234e27db8405164f46 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -677,14 +677,6 @@ typedef void* os_thread_ret_t; # define UNIV_MEM_ASSERT_W(addr, size) do {} while(0) # define UNIV_MEM_TRASH(addr, c, size) do {} while(0) #endif -#define UNIV_MEM_ASSERT_AND_FREE(addr, size) do { \ - UNIV_MEM_ASSERT_W(addr, size); \ - UNIV_MEM_FREE(addr, size); \ -} while (0) -#define UNIV_MEM_ASSERT_AND_ALLOC(addr, size) do { \ - UNIV_MEM_ASSERT_W(addr, size); \ - UNIV_MEM_ALLOC(addr, size); \ -} while (0) extern ulong srv_page_size_shift; extern ulong srv_page_size; diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index cdf517ce176e547fc7111f9c46e1ce43cd94517d..ffdb13ddf4361b64accf3179e663d9f975dff961 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2017, Oracle 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 as published by the Free Software @@ -291,6 +291,7 @@ UNIV_INTERN ulint ut_time_ms(void); /*============*/ + #endif /* !UNIV_HOTBACKUP */ /**********************************************************//** diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 61385891b7688c6372c4b96b2a552dda3b3dc8a2..64e7a8b96adb0aa1c9798fe7c53b971530327550 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation +Copyright (c) 2014, 2018, 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 @@ -6910,7 +6910,7 @@ lock_rec_block_validate( /* Make sure that the tablespace is not deleted while we are trying to access the page. */ - if (fil_space_t* space = fil_space_acquire(space_id)) { + if (fil_space_t* space = fil_space_acquire_silent(space_id)) { mtr_start(&mtr); block = buf_page_get_gen( diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc index 13d691187799082f7c64c8a66d0c657913956fde..ec3c72cab43b10d0740a2b2595f9b472afbf4989 100644 --- a/storage/innobase/log/log0crypt.cc +++ b/storage/innobase/log/log0crypt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2018, 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 @@ -70,22 +70,6 @@ struct crypt_info_t { static std::deque crypt_info; -/*********************************************************************//** -Get a log block's start lsn. -@return a log block's start lsn */ -static inline -lsn_t -log_block_get_start_lsn( -/*====================*/ - lsn_t lsn, /*!< in: checkpoint lsn */ - ulint log_block_no) /*!< in: log block number */ -{ - lsn_t start_lsn = - (lsn & (lsn_t)0xffffffff00000000ULL) | - (((log_block_no - 1) & (lsn_t)0x3fffffff) << 9); - return start_lsn; -} - /*********************************************************************//** Get crypt info from checkpoint. @return a crypt info or NULL if not present. */ @@ -162,6 +146,8 @@ Crypt_result log_blocks_crypt( /*=============*/ const byte* block, /*!< in: blocks before encrypt/decrypt*/ + lsn_t lsn, /*!< in: log sequence number of the start + of the buffer */ ulint size, /*!< in: size of block */ byte* dst_block, /*!< out: blocks after encrypt/decrypt */ int what, /*!< in: encrypt or decrypt*/ @@ -171,21 +157,18 @@ log_blocks_crypt( Crypt_result rc = MY_AES_OK; uint dst_len; byte aes_ctr_counter[MY_AES_BLOCK_SIZE]; - byte is_encrypt= what == ENCRYPTION_FLAG_ENCRYPT; - lsn_t lsn = is_encrypt ? log_sys->lsn : srv_start_lsn; const uint src_len = OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE; - for (ulint i = 0; i < size ; i += OS_FILE_LOG_BLOCK_SIZE) { + for (ulint i = 0; i < size ; i += OS_FILE_LOG_BLOCK_SIZE, + lsn += OS_FILE_LOG_BLOCK_SIZE) { ulint log_block_no = log_block_get_hdr_no(log_block); - lsn_t log_block_start_lsn = log_block_get_start_lsn( - lsn, log_block_no); const crypt_info_t* info = crypt_info == NULL ? get_crypt_info(log_block) : crypt_info; #ifdef DEBUG_CRYPT fprintf(stderr, "%s %lu chkpt: %lu key: %u lsn: %lu\n", - is_encrypt ? "crypt" : "decrypt", + what == ENCRYPTION_FLAG_ENCRYPT ? "crypt" : "decrypt", log_block_no, log_block_get_checkpoint_no(log_block), info ? info->key_version : 0, @@ -214,7 +197,7 @@ log_blocks_crypt( // (1-byte, only 5 bits are used). "+" means concatenate. bzero(aes_ctr_counter, MY_AES_BLOCK_SIZE); memcpy(aes_ctr_counter, info->crypt_nonce, 3); - mach_write_to_8(aes_ctr_counter + 3, log_block_start_lsn); + mach_write_to_8(aes_ctr_counter + 3, lsn); mach_write_to_4(aes_ctr_counter + 11, log_block_no); bzero(aes_ctr_counter + 15, 1); @@ -459,19 +442,6 @@ add_crypt_info( return true; } -/*********************************************************************//** -Encrypt log blocks. */ -UNIV_INTERN -Crypt_result -log_blocks_encrypt( -/*===============*/ - const byte* block, /*!< in: blocks before encryption */ - const ulint size, /*!< in: size of blocks, must be multiple of a log block */ - byte* dst_block) /*!< out: blocks after encryption */ -{ - return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT, NULL); -} - /*********************************************************************//** Set next checkpoint's key version to latest one, and generate current key. Key version 0 means no encryption. */ @@ -523,6 +493,8 @@ log_encrypt_before_write( /*=====================*/ ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */ byte* block, /*!< in/out: pointer to a log block */ + lsn_t lsn, /*!< in: log sequence number of + the start of the buffer */ const ulint size) /*!< in: size of log blocks */ { ut_ad(size % OS_FILE_LOG_BLOCK_SIZE == 0); @@ -541,7 +513,8 @@ log_encrypt_before_write( byte* dst_frame = (byte*)malloc(size); //encrypt log blocks content - Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL); + Crypt_result result = log_blocks_crypt( + block, lsn, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL); if (result == MY_AES_OK) { ut_ad(block[0] == dst_frame[0]); @@ -561,13 +534,16 @@ void log_decrypt_after_read( /*===================*/ byte* frame, /*!< in/out: log segment */ + lsn_t lsn, /*!< in: log sequence number of the start + of the buffer */ const ulint size) /*!< in: log segment size */ { ut_ad(size % OS_FILE_LOG_BLOCK_SIZE == 0); byte* dst_frame = (byte*)malloc(size); // decrypt log blocks content - Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL); + Crypt_result result = log_blocks_crypt( + frame, lsn, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL); if (result == MY_AES_OK) { memcpy(frame, dst_frame, size); diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 1c9cbc3a219d2628009eb2288b8eafc0b14dd8cc..7a242b76e854eb7d79d74fc8d55860975ad816e2 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1380,7 +1380,7 @@ log_group_write_buf( ut_a(next_offset / UNIV_PAGE_SIZE <= ULINT_MAX); log_encrypt_before_write(log_sys->next_checkpoint_no, - buf, write_len); + buf, start_lsn, write_len); fil_io(OS_FILE_WRITE | OS_FILE_LOG, true, group->space_id, 0, (ulint) (next_offset / UNIV_PAGE_SIZE), @@ -2335,7 +2335,7 @@ log_group_read_log_seg( log_block_get_checksum(buf), source_offset); #endif - log_decrypt_after_read(buf, len); + log_decrypt_after_read(buf, start_lsn, len); #ifdef DEBUG_CRYPT fprintf(stderr, "AFTER DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx\n", @@ -2576,7 +2576,8 @@ log_group_archive( MONITOR_INC(MONITOR_LOG_IO); //TODO (jonaso): This must be dead code?? - log_encrypt_before_write(log_sys->next_checkpoint_no, buf, len); + log_encrypt_before_write(log_sys->next_checkpoint_no, + buf, start_lsn, len); fil_io(OS_FILE_WRITE | OS_FILE_LOG, false, group->archive_space_id, (ulint) (next_offset / UNIV_PAGE_SIZE), diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc index e066aff5b300000b5ab54ffd1eaad693cc51a0fd..b9f190509eebb549a5e9c3302be21928990953de 100644 --- a/storage/innobase/mem/mem0mem.cc +++ b/storage/innobase/mem/mem0mem.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -506,13 +507,13 @@ mem_heap_block_free( #ifndef UNIV_HOTBACKUP if (!srv_use_sys_malloc) { #ifdef UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(block, len); /* In the debug version we set the memory to a random combination of hex 0xDE and 0xAD. */ - mem_erase_buf((byte*) block, len); -#else /* UNIV_MEM_DEBUG */ - UNIV_MEM_ASSERT_AND_FREE(block, len); + mem_erase_buf((byte*)block, len); #endif /* UNIV_MEM_DEBUG */ + UNIV_MEM_FREE(block, len); } if (type == MEM_HEAP_DYNAMIC || len < UNIV_PAGE_SIZE / 2) { @@ -526,13 +527,13 @@ mem_heap_block_free( } #else /* !UNIV_HOTBACKUP */ #ifdef UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(block, len); /* In the debug version we set the memory to a random combination of hex 0xDE and 0xAD. */ - mem_erase_buf((byte*) block, len); -#else /* UNIV_MEM_DEBUG */ - UNIV_MEM_ASSERT_AND_FREE(block, len); + mem_erase_buf((byte*)block, len); #endif /* UNIV_MEM_DEBUG */ + UNIV_MEM_FREE(block, len); ut_free(block); #endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index b6bbe3347bd3a7db827c0486aed98b409525636a..af32d0519e2f16d50ee7f29a0505d3928b7351c0 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -861,13 +862,10 @@ rec_get_converted_size_comp_prefix_low( if (fixed_len) { #ifdef UNIV_DEBUG - ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); - ut_ad(len <= fixed_len); - ut_ad(!mbmaxlen || len >= mbminlen - * (fixed_len / mbmaxlen)); + ut_ad(!col->mbmaxlen || len >= col->mbminlen + * (fixed_len / col->mbmaxlen)); /* dict_index_add_col() should guarantee this */ ut_ad(!field->prefix_len @@ -1254,14 +1252,10 @@ rec_convert_dtuple_to_rec_comp( it is 128 or more, or when the field is stored externally. */ if (fixed_len) { #ifdef UNIV_DEBUG - ulint mbminlen = DATA_MBMINLEN( - ifield->col->mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN( - ifield->col->mbminmaxlen); - ut_ad(len <= fixed_len); - ut_ad(!mbmaxlen || len >= mbminlen - * (fixed_len / mbmaxlen)); + ut_ad(!ifield->col->mbmaxlen + || len >= ifield->col->mbminlen + * (fixed_len / ifield->col->mbmaxlen)); ut_ad(!dfield_is_ext(field)); #endif /* UNIV_DEBUG */ } else if (dfield_is_ext(field)) { diff --git a/storage/innobase/row/row0ext.cc b/storage/innobase/row/row0ext.cc index ad852577ad2376d0d9a0ce685b697bd206a5d4a8..32b78391d6a66297aa80d7efbcfb9ffa10677476 100644 --- a/storage/innobase/row/row0ext.cc +++ b/storage/innobase/row/row0ext.cc @@ -78,8 +78,7 @@ row_ext_cache_fill( crashed during the execution of btr_free_externally_stored_field(). */ ext->len[i] = btr_copy_externally_stored_field_prefix( - buf, ext->max_len, zip_size, field, f_len, - NULL); + buf, ext->max_len, zip_size, field, f_len); } } } diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 40ddb3a6a87e0e986aa873f09c47170e672adbfa..5ab577ce0203929464c45cc1135366980a67406b 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, 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 @@ -103,8 +103,9 @@ row_merge_create_fts_sort_index( field->col->prtype = idx_field->col->prtype | DATA_NOT_NULL; field->col->mtype = charset == &my_charset_latin1 ? DATA_VARCHAR : DATA_VARMYSQL; - field->col->mbminmaxlen = idx_field->col->mbminmaxlen; - field->col->len = HA_FT_MAXCHARLEN * DATA_MBMAXLEN(field->col->mbminmaxlen); + field->col->mbminlen = idx_field->col->mbminlen; + field->col->mbmaxlen = idx_field->col->mbmaxlen; + field->col->len = HA_FT_MAXCHARLEN * field->col->mbmaxlen; field->fixed_len = 0; @@ -147,7 +148,8 @@ row_merge_create_fts_sort_index( field->col->prtype = DATA_NOT_NULL | DATA_BINARY_TYPE; - field->col->mbminmaxlen = 0; + field->col->mbminlen = 0; + field->col->mbmaxlen = 0; /* The third field is on the word's position in the original doc */ field = dict_index_get_nth_field(new_index, 2); @@ -159,7 +161,8 @@ row_merge_create_fts_sort_index( field->col->len = 4 ; field->fixed_len = 4; field->col->prtype = DATA_NOT_NULL; - field->col->mbminmaxlen = 0; + field->col->mbminlen = 0; + field->col->mbmaxlen = 0; return(new_index); } @@ -537,7 +540,8 @@ row_merge_fts_doc_tokenize( field->type.mtype = DATA_INT; field->type.prtype = DATA_NOT_NULL | DATA_BINARY_TYPE; field->type.len = len; - field->type.mbminmaxlen = 0; + field->type.mbminlen = 0; + field->type.mbmaxlen = 0; cur_len += len; dfield_dup(field, buf->heap); @@ -556,7 +560,8 @@ row_merge_fts_doc_tokenize( field->type.mtype = DATA_INT; field->type.prtype = DATA_NOT_NULL; field->type.len = len; - field->type.mbminmaxlen = 0; + field->type.mbminlen = 0; + field->type.mbmaxlen = 0; cur_len += len; dfield_dup(field, buf->heap); @@ -706,8 +711,7 @@ fts_parallel_tokenization( doc.text.f_str = btr_copy_externally_stored_field( &doc.text.f_len, data, - zip_size, data_len, blob_heap, - NULL); + zip_size, data_len, blob_heap); } else { doc.text.f_str = data; doc.text.f_len = data_len; diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 9cf55699d3f97fc58b188ba4b17aa3ef3e973fcd..cc5fe0acf926d4381dccbafd9ea8455e135241c3 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, 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 @@ -1258,7 +1258,8 @@ row_import::match_table_columns( err = DB_ERROR; } - if (cfg_col->mbminmaxlen != col->mbminmaxlen) { + if (cfg_col->mbminlen != col->mbminlen + || cfg_col->mbmaxlen != col->mbmaxlen) { ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, @@ -2876,7 +2877,9 @@ row_import_read_columns( col->len = mach_read_from_4(ptr); ptr += sizeof(ib_uint32_t); - col->mbminmaxlen = mach_read_from_4(ptr); + ulint mbminmaxlen = mach_read_from_4(ptr); + col->mbmaxlen = mbminmaxlen / 5; + col->mbminlen = mbminmaxlen % 5; ptr += sizeof(ib_uint32_t); col->ind = mach_read_from_4(ptr); diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index bc369ad444b77f82fe29abec9dfb44586d9f4a1c..c50eaa2a653cf01b52a27ca2a7d06d3f0192c96d 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -565,7 +565,8 @@ row_ins_cascade_calc_update_vec( if (!dfield_is_null(&ufield->new_val) && dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, + col->mbminlen, col->mbmaxlen, col->len, ufield_len, static_cast( @@ -1324,7 +1325,7 @@ row_ins_foreign_check_on_constraint( row_mysql_freeze_data_dictionary(thr_get_trx(thr)); - mtr_start_trx(mtr, trx); + mtr_start(mtr); /* Restore pcur position */ @@ -1352,7 +1353,7 @@ row_ins_foreign_check_on_constraint( btr_pcur_store_position(pcur, mtr); mtr_commit(mtr); - mtr_start_trx(mtr, trx); + mtr_start(mtr); btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr); @@ -1565,7 +1566,7 @@ row_ins_check_foreign_constraint( } } - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Store old value on n_fields_cmp */ @@ -2360,7 +2361,7 @@ row_ins_clust_index_entry_low( || n_uniq == dict_index_get_n_unique(index)); ut_ad(!n_uniq || n_uniq == dict_index_get_n_unique(index)); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) { mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED; @@ -2579,10 +2580,9 @@ Starts a mini-transaction and checks if the index will be dropped. @return true if the index is to be dropped */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool -row_ins_sec_mtr_start_trx_and_check_if_aborted( +row_ins_sec_mtr_start_and_check_if_aborted( /*=======================================*/ mtr_t* mtr, /*!< out: mini-transaction */ - trx_t* trx, /*!< in: transaction handle */ dict_index_t* index, /*!< in/out: secondary index */ bool check, /*!< in: whether to check */ ulint search_mode) @@ -2590,7 +2590,7 @@ row_ins_sec_mtr_start_trx_and_check_if_aborted( { ut_ad(!dict_index_is_clust(index)); - mtr_start_trx(mtr, trx); + mtr_start(mtr); if (!check) { return(false); @@ -2648,14 +2648,13 @@ row_ins_sec_index_entry_low( ulint n_unique; mtr_t mtr; ulint* offsets = NULL; - trx_t* trx = thr_get_trx(thr); ut_ad(!dict_index_is_clust(index)); ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE); cursor.thr = thr; ut_ad(thr_get_trx(thr)->id); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Ensure that we acquire index->lock when inserting into an index with index->online_status == ONLINE_INDEX_COMPLETE, but @@ -2693,7 +2692,7 @@ row_ins_sec_index_entry_low( if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning(trx->mysql_thd, + ib_push_warning(thr_get_trx(thr)->mysql_thd, DB_DECRYPTION_FAILED, "Table %s is encrypted but encryption service or" " used key_id is not available. " @@ -2729,8 +2728,8 @@ row_ins_sec_index_entry_low( DEBUG_SYNC_C("row_ins_sec_index_unique"); - if (row_ins_sec_mtr_start_trx_and_check_if_aborted( - &mtr, trx, index, check, search_mode)) { + if (row_ins_sec_mtr_start_and_check_if_aborted( + &mtr, index, check, search_mode)) { goto func_exit; } @@ -2764,8 +2763,8 @@ row_ins_sec_index_entry_low( return(err); } - if (row_ins_sec_mtr_start_trx_and_check_if_aborted( - &mtr, trx, index, check, search_mode)) { + if (row_ins_sec_mtr_start_and_check_if_aborted( + &mtr, index, check, search_mode)) { goto func_exit; } @@ -3074,7 +3073,7 @@ row_ins_index_entry_set_vals( = dict_field_get_col(ind_field); len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, col->mbminlen, col->mbmaxlen, ind_field->prefix_len, len, static_cast( diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 49627a6501468766c58555d0154cb466d5171fbc..fd5a13bbaabd910de0edd7ccd1973cf1ddc460f3 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -1064,7 +1064,7 @@ row_log_table_get_pk_col( mem_heap_alloc(heap, field_len)); len = btr_copy_externally_stored_field_prefix( - blob_field, field_len, zip_size, field, len, NULL); + blob_field, field_len, zip_size, field, len); if (len >= max_len + 1) { return(DB_TOO_BIG_INDEX_COL); } @@ -1183,7 +1183,7 @@ row_log_table_get_pk( dict_field_t* ifield; dfield_t* dfield; ulint prtype; - ulint mbminmaxlen; + ulint mbminlen, mbmaxlen; ifield = dict_index_get_nth_field(new_index, new_i); dfield = dtuple_get_nth_field(tuple, new_i); @@ -1212,7 +1212,8 @@ row_log_table_get_pk( goto func_exit; } - mbminmaxlen = col->mbminmaxlen; + mbminlen = col->mbminlen; + mbmaxlen = col->mbmaxlen; prtype = col->prtype; } else { /* No matching column was found in the old @@ -1222,7 +1223,8 @@ row_log_table_get_pk( dfield_copy(dfield, dtuple_get_nth_field( log->add_cols, col_no)); - mbminmaxlen = dfield->type.mbminmaxlen; + mbminlen = dfield->type.mbminlen; + mbmaxlen = dfield->type.mbmaxlen; prtype = dfield->type.prtype; } @@ -1231,7 +1233,7 @@ row_log_table_get_pk( if (ifield->prefix_len) { ulint len = dtype_get_at_most_n_mbchars( - prtype, mbminmaxlen, + prtype, mbminlen, mbmaxlen, ifield->prefix_len, dfield_get_len(dfield), static_cast( @@ -1455,7 +1457,7 @@ row_log_table_apply_convert_mrec( data = btr_rec_copy_externally_stored_field( mrec, offsets, dict_table_zip_size(index->table), - i, &len, heap, NULL); + i, &len, heap); ut_a(data); dfield_set_data(dfield, data, len); blob_done: diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index f4120e5fd90839e5a98724b1239c875a9297836a..80ab10cdbc0d1052eb9bc020f980a40996cfeb12 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, 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 @@ -267,8 +267,8 @@ row_merge_buf_redundant_convert( ulint zip_size, mem_heap_t* heap) { - ut_ad(DATA_MBMINLEN(field->type.mbminmaxlen) == 1); - ut_ad(DATA_MBMAXLEN(field->type.mbminmaxlen) > 1); + ut_ad(field->type.mbminlen == 1); + ut_ad(field->type.mbmaxlen > 1); byte* buf = (byte*) mem_heap_alloc(heap, len); ulint field_len = row_field->len; @@ -284,7 +284,7 @@ row_merge_buf_redundant_convert( field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE)); byte* data = btr_copy_externally_stored_field( - &ext_len, field_data, zip_size, field_len, heap, NULL); + &ext_len, field_data, zip_size, field_len, heap); ut_ad(ext_len < len); @@ -394,7 +394,8 @@ row_merge_buf_add( field->type.mtype = ifield->col->mtype; field->type.prtype = ifield->col->prtype; - field->type.mbminmaxlen = DATA_MBMINMAXLEN(0, 0); + field->type.mbminlen = 0; + field->type.mbmaxlen = 0; field->type.len = ifield->col->len; } else { row_field = dtuple_get_nth_field(row, col_no); @@ -529,7 +530,7 @@ row_merge_buf_add( if (ifield->prefix_len) { len = dtype_get_at_most_n_mbchars( col->prtype, - col->mbminmaxlen, + col->mbminlen, col->mbmaxlen, ifield->prefix_len, len, static_cast(dfield_get_data(field))); @@ -540,8 +541,7 @@ row_merge_buf_add( fixed_len = ifield->fixed_len; if (fixed_len && !dict_table_is_comp(index->table) - && DATA_MBMINLEN(col->mbminmaxlen) - != DATA_MBMAXLEN(col->mbminmaxlen)) { + && col->mbminlen != col->mbmaxlen) { /* CHAR in ROW_FORMAT=REDUNDANT is always fixed-length, but in the temporary file it is variable-length for variable-length character @@ -551,14 +551,11 @@ row_merge_buf_add( if (fixed_len) { #ifdef UNIV_DEBUG - ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); - /* len should be between size calcualted base on mbmaxlen and mbminlen */ ut_ad(len <= fixed_len); - ut_ad(!mbmaxlen || len >= mbminlen - * (fixed_len / mbmaxlen)); + ut_ad(!col->mbmaxlen || len >= col->mbminlen + * (fixed_len / col->mbmaxlen)); ut_ad(!dfield_is_ext(field)); #endif /* UNIV_DEBUG */ @@ -2623,7 +2620,7 @@ row_merge_copy_blobs( BLOB pointers are read (row_merge_read_clustered_index()) and dereferenced (below). */ data = btr_rec_copy_externally_stored_field( - mrec, offsets, zip_size, i, &len, heap, NULL); + mrec, offsets, zip_size, i, &len, heap); /* Because we have locked the table, any records written by incomplete transactions must have been rolled back already. There must not be any incomplete diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index b78a8b58ac86727e8adf23ba0f5c7775b4e279d1..36ca5c7767b0f6579ff3c37ff60083b9f9e06695 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, 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 @@ -1986,7 +1986,7 @@ row_unlock_for_mysql( trx_id_t rec_trx_id; mtr_t mtr; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Restore the cursor position and find the record */ @@ -2871,7 +2871,7 @@ row_add_table_to_background_drop_list(table_id_t table_id) /*********************************************************************//** Reassigns the table identifier of a table. @return error code or DB_SUCCESS */ -UNIV_INTERN +static dberr_t row_mysql_table_id_reassign( /*========================*/ @@ -3562,7 +3562,7 @@ row_truncate_table_for_mysql( index = dict_table_get_next_index(index); } while (index); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); fsp_header_init(space_id, FIL_IBD_FILE_INITIAL_SIZE, &mtr); mtr_commit(&mtr); @@ -3591,7 +3591,7 @@ row_truncate_table_for_mysql( sys_index = dict_table_get_first_index(dict_sys->sys_indexes); dict_index_copy_types(tuple, sys_index, 1); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, &pcur, &mtr); for (;;) { @@ -3638,7 +3638,7 @@ row_truncate_table_for_mysql( a page in this mini-transaction, and the rest of this loop could latch another index page. */ mtr_commit(&mtr); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr); } diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 1ed8b7377d95ea756e692ec59f9eec50908c4792..98504b1e9730ccf4ef992c730e7c514d0a3e7e1a 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -823,7 +823,7 @@ row_purge_parse_undo_rec( if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { ptr = trx_undo_rec_get_partial_row( - ptr, clust_index, &node->row, + ptr, clust_index, node->update, &node->row, type == TRX_UNDO_UPD_DEL_REC, node->heap); } diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index 6c4e6adb96ce6e655bbbf2972b9b6d726ac166b5..53b4040f74e8a21b7236e45bad3449103ca47f81 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -237,7 +237,11 @@ row_quiesce_write_table( mach_write_to_4(ptr, col->len); ptr += sizeof(ib_uint32_t); - mach_write_to_4(ptr, col->mbminmaxlen); + /* FIXME: This will not work if mbminlen>4. + This field is also redundant, because the lengths + are a property of the character set encoding, which + in turn is encodedin prtype above. */ + mach_write_to_4(ptr, col->mbmaxlen * 5 + col->mbminlen); ptr += sizeof(ib_uint32_t); mach_write_to_4(ptr, col->ind); diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index 96d25e15777dbcb848c64c224857f5f1d6175446..9bf9e7182ca670118405508a974def4ec80487a7 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -173,7 +174,7 @@ row_build_index_entry_low( /* If a column prefix index, take only the prefix. */ if (ind_field->prefix_len) { len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, col->mbminlen, col->mbmaxlen, ind_field->prefix_len, len, static_cast(dfield_get_data(dfield))); dfield_set_len(dfield, len); @@ -588,7 +589,8 @@ row_build_row_ref( dfield_set_len(dfield, dtype_get_at_most_n_mbchars( dtype->prtype, - dtype->mbminmaxlen, + dtype->mbminlen, + dtype->mbmaxlen, clust_col_prefix_len, len, (char*) field)); } @@ -702,7 +704,8 @@ row_build_row_ref_in_tuple( dfield_set_len(dfield, dtype_get_at_most_n_mbchars( dtype->prtype, - dtype->mbminmaxlen, + dtype->mbminlen, + dtype->mbmaxlen, clust_col_prefix_len, len, (char*) field)); } diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index d309cf4c7422671de8bcde791bb5d6469754bceb..6cca3e21c794870add0d4c050c57c5776009623b 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -94,8 +94,10 @@ row_sel_sec_rec_is_for_blob( /*========================*/ ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multi-byte character */ + ulint mbminlen, /*!< in: minimum length of + a character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of + a character, in bytes */ const byte* clust_field, /*!< in: the locally stored part of the clustered index column, including the BLOB pointer; the clustered @@ -134,8 +136,7 @@ row_sel_sec_rec_is_for_blob( len = btr_copy_externally_stored_field_prefix(buf, prefix_len, zip_size, - clust_field, clust_len, - NULL); + clust_field, clust_len); if (UNIV_UNLIKELY(len == 0)) { /* The BLOB was being deleted as the server crashed. @@ -146,7 +147,7 @@ row_sel_sec_rec_is_for_blob( return(FALSE); } - len = dtype_get_at_most_n_mbchars(prtype, mbminmaxlen, + len = dtype_get_at_most_n_mbchars(prtype, mbminlen, mbmaxlen, prefix_len, len, (const char*) buf); return(!cmp_data_data(mtype, prtype, buf, len, sec_field, sec_len)); @@ -230,14 +231,14 @@ row_sel_sec_rec_is_for_clust_rec( } len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, col->mbminlen, col->mbmaxlen, ifield->prefix_len, len, (char*) clust_field); if (rec_offs_nth_extern(clust_offs, clust_pos) && len < sec_len) { if (!row_sel_sec_rec_is_for_blob( col->mtype, col->prtype, - col->mbminmaxlen, + col->mbminlen, col->mbmaxlen, clust_field, clust_len, sec_field, sec_len, ifield->prefix_len, @@ -454,7 +455,7 @@ row_sel_fetch_columns( data = btr_rec_copy_externally_stored_field( rec, offsets, dict_table_zip_size(index->table), - field_no, &len, heap, NULL); + field_no, &len, heap); /* data == NULL means that the externally stored field was not @@ -1401,7 +1402,7 @@ row_sel( /* Open a cursor to index, or restore an open cursor position */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (consistent_read && plan->unique_search && !plan->pcur_is_open && !plan->must_get_clust @@ -1441,7 +1442,7 @@ row_sel( plan_reset_cursor(plan); mtr_commit(&mtr); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); } if (search_latch_locked) { @@ -2812,7 +2813,7 @@ row_sel_store_mysql_field_func( data = btr_rec_copy_externally_stored_field( rec, offsets, dict_table_zip_size(prebuilt->table), - field_no, &len, heap, NULL); + field_no, &len, heap); if (UNIV_UNLIKELY(!data)) { /* The externally stored field was not written @@ -3930,7 +3931,7 @@ row_search_for_mysql( } } - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /*-------------------------------------------------------------*/ /* PHASE 2: Try fast adaptive hash index search if possible */ @@ -4061,7 +4062,7 @@ row_search_for_mysql( } mtr_commit(&mtr); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); } } @@ -5137,7 +5138,7 @@ row_search_for_mysql( mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); if (sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr)) { @@ -5204,7 +5205,7 @@ row_search_for_mysql( /* It was a lock wait, and it ended */ thr->lock_state = QUE_THR_LOCK_NOLOCK; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Table lock waited, go try to obtain table lock again */ diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index 4aa5cfdc4da637105c9706ed76ebdbfff16e15d6..6c5e808cc3829ccd51dee8d41d69c4e1b98535d3 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -299,7 +299,7 @@ row_undo_mod_clust( pcur = &node->pcur; index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur)); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); online = dict_index_is_online_ddl(index); if (online) { @@ -328,7 +328,7 @@ row_undo_mod_clust( /* We may have to modify tree structure: do a pessimistic descent down the index tree */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); err = row_undo_mod_clust_low( node, &offsets, &offsets_heap, @@ -380,7 +380,7 @@ row_undo_mod_clust( if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) { - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); /* It is not necessary to call row_log_table, because the record is delete-marked and would thus @@ -393,7 +393,7 @@ row_undo_mod_clust( /* We may have to modify tree structure: do a pessimistic descent down the index tree */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); err = row_undo_mod_remove_clust_low(node, thr, &mtr, BTR_MODIFY_TREE); @@ -440,7 +440,7 @@ row_undo_mod_del_mark_or_remove_sec_low( enum row_search_result search_result; log_free_check(); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (mode == BTR_MODIFY_TREE && index->space == IBUF_SPACE_ID && !dict_index_is_unique(index)) { @@ -501,7 +501,7 @@ row_undo_mod_del_mark_or_remove_sec_low( which cannot be purged yet, requires its existence. If some requires, we should delete mark the record. */ - mtr_start_trx(&mtr_vers, thr_get_trx(thr)); + mtr_start(&mtr_vers); success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur), &mtr_vers); @@ -617,7 +617,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( ut_ad(trx->id); log_free_check(); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (mode == BTR_MODIFY_TREE && index->space == IBUF_SPACE_ID && !dict_index_is_unique(index)) { diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index ef51e2046ae41ebd9e2db76e1fffba0671af34a2..e2de47bf86aab3c1c37ff1ad27a8a11cb2d9adf8 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -259,7 +260,7 @@ row_upd_check_references_constraints( DEBUG_SYNC_C("foreign_constraint_check_for_update"); - mtr_start_trx(mtr, trx); + mtr_start(mtr); if (trx->dict_operation_lock_mode == 0) { got_s_lock = TRUE; @@ -1152,7 +1153,7 @@ row_upd_ext_fetch( byte* buf = static_cast(mem_heap_alloc(heap, *len)); *len = btr_copy_externally_stored_field_prefix( - buf, *len, zip_size, data, local_len, NULL); + buf, *len, zip_size, data, local_len); /* We should never update records containing a half-deleted BLOB. */ ut_a(*len); @@ -1204,7 +1205,7 @@ row_upd_index_replace_new_col_val( } len = dtype_get_at_most_n_mbchars(col->prtype, - col->mbminmaxlen, + col->mbminlen, col->mbmaxlen, field->prefix_len, len, (const char*) data); @@ -1852,7 +1853,7 @@ row_upd_sec_index_entry( } #endif /* UNIV_DEBUG */ - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); if (*index->name == TEMP_INDEX_PREFIX) { /* The index->online_status may change if the @@ -2389,7 +2390,7 @@ row_upd_clust_rec( /* We may have to modify the tree structure: do a pessimistic descent down the index tree */ - mtr_start_trx(mtr, thr_get_trx(thr)); + mtr_start(mtr); /* NOTE: this transaction has an s-lock or x-lock on the record and therefore other transactions cannot modify the record when we have no @@ -2601,7 +2602,7 @@ row_upd_clust_step( /* We have to restore the cursor to its position */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); /* If the restoration does not succeed, then the same transaction has deleted the record on which the cursor was, @@ -2655,7 +2656,7 @@ row_upd_clust_step( mtr_commit(&mtr); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, &mtr); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 749ece33a067fb1fdd54903d53f91edd4fdf3f57..cb003edfbdc6d3d13b2ce567c9ea5930d009a954 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -77,10 +77,6 @@ Created 10/8/1995 Heikki Tuuri #include "fil0pagecompress.h" #include "btr0scrub.h" -#ifdef WITH_WSREP -extern int wsrep_debug; -extern int wsrep_trx_is_aborting(void *thd_ptr); -#endif /* The following is the maximum allowed duration of a lock wait. */ UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT; diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 5553de4814fe42fc8ed84d1f17c08c7f221a82b4..9e5e90128cb08bc22cefa66707f2874ea35dd919 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -584,32 +584,6 @@ trx_purge_rseg_get_next_history_log( mutex_exit(&(rseg->mutex)); mtr_commit(&mtr); - - mutex_enter(&trx_sys->mutex); - - /* Add debug code to track history list corruption reported - on the MySQL mailing list on Nov 9, 2004. The fut0lst.cc - file-based list was corrupt. The prev node pointer was - FIL_NULL, even though the list length was over 8 million nodes! - We assume that purge truncates the history list in large - size pieces, and if we here reach the head of the list, the - list cannot be longer than 2000 000 undo logs now. */ - - if (trx_sys->rseg_history_len > 2000000) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Warning: purge reached the" - " head of the history list,\n" - "InnoDB: but its length is still" - " reported as %lu! Make a detailed bug\n" - "InnoDB: report, and submit it" - " to https://jira.mariadb.org/\n", - (ulong) trx_sys->rseg_history_len); - ut_ad(0); - } - - mutex_exit(&trx_sys->mutex); - return; } diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 10eadcb6d7e906997825c5553ebaf07f5c75c7d0..cd5e51d4973789f26b8ed1a1c26626d81dfb0c7a 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -467,7 +467,7 @@ trx_undo_page_fetch_ext( { /* Fetch the BLOB. */ ulint ext_len = btr_copy_externally_stored_field_prefix( - ext_buf, prefix_len, zip_size, field, *len, NULL); + ext_buf, prefix_len, zip_size, field, *len); /* BLOBs should always be nonempty. */ ut_a(ext_len); /* Append the BLOB pointer to the prefix. */ @@ -1076,6 +1076,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used @@ -1103,6 +1104,13 @@ trx_undo_rec_get_partial_row( ->mtype = DATA_MISSING; } + for (const upd_field_t* uf = update->fields, * const ue + = update->fields + update->n_fields; + uf != ue; uf++) { + ulint c = dict_index_get_nth_col(index, uf->field_no)->ind; + *dtuple_get_nth_field(*row, c) = uf->new_val; + } + end_ptr = ptr + mach_read_from_2(ptr); ptr += 2; @@ -1123,6 +1131,10 @@ trx_undo_rec_get_partial_row( ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); dfield = dtuple_get_nth_field(*row, col_no); + ut_ad(dfield->type.mtype == DATA_MISSING + || dict_col_type_assert_equal(col, &dfield->type)); + ut_ad(dfield->type.mtype == DATA_MISSING + || dfield->len == len); dict_col_copy_type( dict_table_get_nth_col(index->table, col_no), dfield_get_type(dfield)); @@ -1255,7 +1267,7 @@ trx_undo_report_row_operation( rseg = trx->rseg; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); mutex_enter(&trx->undo_mutex); /* If the undo log is not assigned yet, assign one */ @@ -1331,7 +1343,7 @@ trx_undo_report_row_operation( latches, such as SYNC_FSP and SYNC_FSP_PAGE. */ mtr_commit(&mtr); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); mutex_enter(&rseg->mutex); trx_undo_free_last_page(trx, undo, &mtr); @@ -1368,7 +1380,7 @@ trx_undo_report_row_operation( /* We have to extend the undo log by one page */ ut_ad(++loop_count < 2); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* When we add a page to an undo log, this is analogous to a pessimistic insert in a B-tree, and we must reserve the diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 2c7287d44cfaf71bb96e1a465ee465e06fd64172..e5c57aa21cec226f96446adc2e26cac800d4de0f 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2018, 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 @@ -739,7 +739,8 @@ trx_roll_must_shutdown() mutex_enter(&recv_sys->mutex); if (recv_sys->report(time)) { - ulint n_trx = 0, n_rows = 0; + ulint n_trx = 0; + ulonglong n_rows = 0; for (const trx_t* t = UT_LIST_GET_FIRST(trx_sys->rw_trx_list); t != NULL; t = UT_LIST_GET_NEXT(trx_list, t)) { @@ -753,9 +754,9 @@ trx_roll_must_shutdown() } ib_logf(IB_LOG_LEVEL_INFO, "To roll back: " ULINTPF " transactions, " - ULINTPF " rows", n_trx, n_rows); + "%llu rows", n_trx, n_rows); sd_notifyf(0, "STATUS=To roll back: " ULINTPF " transactions, " - ULINTPF " rows", n_trx, n_rows); + "%llu rows", n_trx, n_rows); } mutex_exit(&recv_sys->mutex); diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc index 5638ccd17a6dda17e87d53089bb44c13fe34638a..d6bcd131a4f17b80f252b4777a536f62aac1ae55 100644 --- a/storage/innobase/trx/trx0undo.cc +++ b/storage/innobase/trx/trx0undo.cc @@ -1070,9 +1070,11 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end( +trx_undo_truncate_end_func( /*=======================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction whose undo log it is */ +#endif /* UNIV_DEBUG */ trx_undo_t* undo, /*!< in: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ @@ -1087,7 +1089,7 @@ trx_undo_truncate_end( ut_ad(mutex_own(&(trx->rseg->mutex))); for (;;) { - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); trunc_here = NULL; @@ -1774,7 +1776,7 @@ trx_undo_assign_undo( ut_ad(mutex_own(&(trx->undo_mutex))); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); mutex_enter(&rseg->mutex); diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 181e713cca90ead983881f045bfd1db3faeca8d6..2a430c9c42271b1e9149fb0c6871fe4b9a3608f3 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2017, Oracle 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 as published by the Free Software @@ -46,6 +46,9 @@ Created 5/11/1994 Heikki Tuuri #endif /* UNIV_HOTBACKUP */ #ifdef __WIN__ +typedef VOID(WINAPI *time_fn)(LPFILETIME); +static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime; + /*****************************************************************//** NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix epoch starts from 1970/1/1. For selection of constant see: @@ -71,7 +74,7 @@ ut_gettimeofday( return(-1); } - GetSystemTimeAsFileTime(&ft); + ut_get_system_time_as_file_time(&ft); tm = (ib_int64_t) ft.dwHighDateTime << 32; tm |= ft.dwLowDateTime; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 47f759e0c050f68771674a27d443217b8a4c802b..47b24e1030b653af00bc49c4e4906409117d9e5e 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2134,11 +2134,16 @@ void ha_maria::start_bulk_insert(ha_rows rows, uint flags) safety net for now, we don't remove the test of file->state->records, because there is uncertainty on what will happen during repair if the two states disagree. + + We also have to check in case of transactional tables that the + user has not used LOCK TABLE on the table twice. */ if ((file->state->records == 0) && (share->state.state.records == 0) && can_enable_indexes && (!rows || rows >= MARIA_MIN_ROWS_TO_DISABLE_INDEXES) && - (file->lock.type == TL_WRITE || file->lock.type == TL_UNLOCK)) + (file->lock.type == TL_WRITE || file->lock.type == TL_UNLOCK) && + (!share->have_versioning || !share->now_transactional || + file->used_tables->use_count == 1)) { /** @todo for a single-row INSERT SELECT, we will go into repair, which diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 575965582086bf22534448d7ec4ad690f2c05557..c4ec3cf2f9adfa9c02e4e6d98eb00fd2a2160bec 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -6166,7 +6166,7 @@ my_bool write_hook_for_undo_row_insert(enum translog_record_type type /** - @brief Upates "records" and calls the generic UNDO hook + @brief Updates "records" and calls the generic UNDO hook @return Operation status, always 0 (success) */ @@ -6316,8 +6316,8 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn, uchar *buff, *dir; uint result; MARIA_PINNED_PAGE page_link; - enum pagecache_page_lock unlock_method; - enum pagecache_page_pin unpin_method; + enum pagecache_page_lock lock_method; + enum pagecache_page_pin pin_method; my_off_t end_of_page; uint error; DBUG_ENTER("_ma_apply_redo_insert_row_head_or_tail"); @@ -6345,8 +6345,8 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn, fill it entirely with zeroes, then the REDO will put correct data on it. */ - unlock_method= PAGECACHE_LOCK_WRITE; - unpin_method= PAGECACHE_PIN; + lock_method= PAGECACHE_LOCK_WRITE; + pin_method= PAGECACHE_PIN; DBUG_ASSERT(rownr == 0 && new_page); if (rownr != 0 || !new_page) @@ -6361,8 +6361,8 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn, } else { - unlock_method= PAGECACHE_LOCK_LEFT_WRITELOCKED; - unpin_method= PAGECACHE_PIN_LEFT_PINNED; + lock_method= PAGECACHE_LOCK_LEFT_WRITELOCKED; + pin_method= PAGECACHE_PIN_LEFT_PINNED; share->pagecache->readwrite_flags&= ~MY_WME; buff= pagecache_read(share->pagecache, &info->dfile, @@ -6463,11 +6463,11 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn, this group, for this page, would be skipped) and unpin then. */ result= 0; - if (unlock_method == PAGECACHE_LOCK_WRITE && + if (lock_method == PAGECACHE_LOCK_WRITE && pagecache_write(share->pagecache, &info->dfile, page, 0, buff, PAGECACHE_PLAIN_PAGE, - unlock_method, unpin_method, + lock_method, pin_method, PAGECACHE_WRITE_DELAY, &page_link.link, LSN_IMPOSSIBLE)) result= my_errno; @@ -6488,7 +6488,7 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn, _ma_set_fatal_error(share, HA_ERR_WRONG_IN_RECORD); err: error= my_errno; - if (unlock_method == PAGECACHE_LOCK_LEFT_WRITELOCKED) + if (lock_method == PAGECACHE_LOCK_LEFT_WRITELOCKED) pagecache_unlock_by_link(share->pagecache, page_link.link, PAGECACHE_LOCK_WRITE_UNLOCK, PAGECACHE_UNPIN, LSN_IMPOSSIBLE, diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c index 4021fb8e161e831cd37f3f323d8d7b3f2bbce97d..2f77f6f87ec5c4447f0befd334bb71b9b91f2635 100644 --- a/storage/maria/ma_page.c +++ b/storage/maria/ma_page.c @@ -224,17 +224,35 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock, #endif page_cleanup(share, page); - res= pagecache_write(share->pagecache, - &share->kfile, - (pgcache_page_no_t) (page->pos / block_size), - level, buff, share->page_type, - lock, - lock == PAGECACHE_LOCK_LEFT_WRITELOCKED ? - PAGECACHE_PIN_LEFT_PINNED : - (lock == PAGECACHE_LOCK_WRITE_UNLOCK ? - PAGECACHE_UNPIN : PAGECACHE_PIN), - PAGECACHE_WRITE_DELAY, &page_link.link, - LSN_IMPOSSIBLE); + { + PAGECACHE_BLOCK_LINK **link; + enum pagecache_page_pin pin; + if (lock == PAGECACHE_LOCK_LEFT_WRITELOCKED) + { + pin= PAGECACHE_PIN_LEFT_PINNED; + link= &page_link.link; + } + else if (lock == PAGECACHE_LOCK_WRITE_UNLOCK) + { + pin= PAGECACHE_UNPIN; + /* + We unlock this page so link should be 0 to prevent it usage + even accidentally + */ + link= NULL; + } + else + { + pin= PAGECACHE_PIN; + link= &page_link.link; + } + res= pagecache_write(share->pagecache, + &share->kfile, + (pgcache_page_no_t) (page->pos / block_size), + level, buff, share->page_type, + lock, pin, PAGECACHE_WRITE_DELAY, link, + LSN_IMPOSSIBLE); + } if (lock == PAGECACHE_LOCK_WRITE) { diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c index 951850b16a4e3d3e3ddbbceda73857648e740849..0132dc95e5e4e14f405f93e83c5e25d6d5113061 100644 --- a/storage/maria/ma_search.c +++ b/storage/maria/ma_search.c @@ -745,11 +745,11 @@ void _ma_kpointer(register MARIA_HA *info, register uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; @@ -881,13 +881,13 @@ void _ma_dpointer(MARIA_SHARE *share, uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 8: *buff++=0; - /* fall trough */ + /* fall through */ case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c index 88ce88b8f9845bdd52d5434df3861e0e40af0d9b..7404fe06641c674dfa6512ddf8fa2c90c002d398 100644 --- a/storage/maria/ma_state.c +++ b/storage/maria/ma_state.c @@ -58,6 +58,7 @@ my_bool _ma_setup_live_state(MARIA_HA *info) MARIA_USED_TABLES *tables; MARIA_STATE_HISTORY *history; DBUG_ENTER("_ma_setup_live_state"); + DBUG_PRINT("enter", ("info: %p", info)); DBUG_ASSERT(share->lock_key_trees); @@ -110,6 +111,8 @@ my_bool _ma_setup_live_state(MARIA_HA *info) end: info->state_start= &tables->state_start; info->state= &tables->state_current; + info->used_tables= tables; + tables->use_count++; /* Mark in transaction state if we are not using transid (versioning) @@ -118,6 +121,7 @@ my_bool _ma_setup_live_state(MARIA_HA *info) */ tables->state_current.no_transid|= !(info->row_flag & ROW_FLAG_TRANSID); + DBUG_PRINT("exit", ("tables: %p info->state: %p", tables, info->state)); DBUG_RETURN(0); } @@ -241,9 +245,10 @@ void _ma_reset_state(MARIA_HA *info) DBUG_ENTER("_ma_reset_state"); /* Always true if share->now_transactional is set */ - if (history) + if (history && share->have_versioning) { MARIA_STATE_HISTORY *next; + DBUG_PRINT("info", ("resetting history")); /* Set the current history to current state */ share->state_history->state= share->state.state; @@ -255,7 +260,7 @@ void _ma_reset_state(MARIA_HA *info) my_free(history); } share->state_history->next= 0; - share->state_history->trid= 0; /* Visibile for all */ + share->state_history->trid= 0; /* Visible for all */ } DBUG_VOID_RETURN; } @@ -597,7 +602,7 @@ void _ma_remove_table_from_trnman(MARIA_SHARE *share, TRN *trn) SYNOPSIS _ma_get_status() - param Pointer to Myisam handler + param Pointer to Aria handler concurrent_insert Set to 1 if we are going to do concurrent inserts (THR_WRITE_CONCURRENT_INSERT was used) */ @@ -627,6 +632,8 @@ void _ma_block_get_status(void* param, my_bool concurrent_insert) my_bool _ma_block_start_trans(void* param) { MARIA_HA *info=(MARIA_HA*) param; + DBUG_ENTER("_ma_block_start_trans"); + if (info->s->lock_key_trees) { /* @@ -634,7 +641,7 @@ my_bool _ma_block_start_trans(void* param) out of memory conditions) TODO: Fix this by having one extra state pre-allocated */ - return _ma_setup_live_state(info); + DBUG_RETURN(_ma_setup_live_state(info)); } else { @@ -663,9 +670,9 @@ my_bool _ma_block_start_trans(void* param) Assume for now that this doesn't fail (It can only fail in out of memory conditions) */ - return maria_create_trn_hook(info) != 0; + DBUG_RETURN(maria_create_trn_hook(info) != 0); } - return 0; + DBUG_RETURN(0); } @@ -697,7 +704,7 @@ my_bool _ma_block_check_status(void *param __attribute__((unused))) my_bool _ma_block_start_trans_no_versioning(void* param) { MARIA_HA *info=(MARIA_HA*) param; - DBUG_ENTER("_ma_block_get_status_no_version"); + DBUG_ENTER("_ma_block_start_trans_no_versioning"); DBUG_ASSERT(info->s->base.born_transactional && !info->s->lock_key_trees); info->state->changed= 0; /* from _ma_reset_update_flag() */ @@ -722,6 +729,8 @@ my_bool _ma_block_start_trans_no_versioning(void* param) void maria_versioning(MARIA_HA *info, my_bool versioning) { MARIA_SHARE *share= info->s; + DBUG_ENTER("maria_versioning"); + /* For now, this is a hack */ if (share->have_versioning) { @@ -738,6 +747,7 @@ void maria_versioning(MARIA_HA *info, my_bool versioning) info->state= &share->state.state; /* Change global values by default */ info->state_start= info->state; /* Initial values */ } + DBUG_VOID_RETURN; } diff --git a/storage/maria/ma_state.h b/storage/maria/ma_state.h index 5ff6dc26337c2ef85490a7712f18d04b95a49eb7..a86aada94fd393c3713da888b1a24262a90094ff 100644 --- a/storage/maria/ma_state.h +++ b/storage/maria/ma_state.h @@ -34,6 +34,7 @@ typedef struct st_used_tables { struct st_maria_share *share; MARIA_STATUS_INFO state_current; MARIA_STATUS_INFO state_start; + uint use_count; } MARIA_USED_TABLES; diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index 34ce530283cbd4a430045a3aed7fc8b83b8b0110..4175a5be18c331d42aeff50931a6925feb1549da 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -340,7 +340,7 @@ int maria_write(MARIA_HA *info, uchar *record) for (j=0 ; j < share->base.keys ; j++) maria_flush_bulk_insert(info, j); } - info->errkey= (int) i; + info->errkey= i < share->base.keys ? (int) i : -1; /* We delete keys in the reverse order of insertion. This is the order that a rollback would do and is important for CLR_ENDs generated by diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 3b93dda2badb1aac1ced29017577a8da194ea184..d57a429365a76cfe770407fb0f01d4e479e14c4a 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -600,6 +600,7 @@ struct st_maria_handler struct st_ma_transaction *trn; /* Pointer to active transaction */ MARIA_STATUS_INFO *state, state_save; MARIA_STATUS_INFO *state_start; /* State at start of transaction */ + MARIA_USED_TABLES *used_tables; MARIA_ROW cur_row; /* The active row that we just read */ MARIA_ROW new_row; /* Storage for a row during update */ MARIA_KEY last_key; /* Last found key */ @@ -1181,7 +1182,7 @@ extern ulonglong transid_get_packed(MARIA_SHARE *share, const uchar *from); #ifdef IDENTICAL_PAGES_AFTER_RECOVERY void page_cleanup(MARIA_SHARE *share, MARIA_PAGE *page) #else -#define page_cleanup(A,B) while (0) +#define page_cleanup(A,B) do { } while (0) #endif extern MARIA_KEY *_ma_make_key(MARIA_HA *info, MARIA_KEY *int_key, uint keynr, diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c index 39cff18a3ab5a67bc67da1edb53c9d89430d0424..1ea31d228e1f9825772acfd78014d2db4df2f67f 100644 --- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c +++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c @@ -233,7 +233,7 @@ int main(int argc __attribute__((unused)), char *argv[]) 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 }; - uchar *long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2); + uchar *long_buffer; char **default_argv; PAGECACHE pagecache; LSN lsn, lsn_base, first_lsn; @@ -255,6 +255,7 @@ int main(int argc __attribute__((unused)), char *argv[]) } #endif + long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2); load_defaults("my", load_default_groups, &argc, &argv); default_argv= argv; get_options(&argc, &argv); @@ -758,9 +759,12 @@ int main(int argc __attribute__((unused)), char *argv[]) if (maria_log_remove(maria_data_root)) exit(1); + free(long_buffer); + my_uuid_end(); my_free_open_file_info(); my_end(0); + return (MY_TEST(exit_status())); } diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c index a6ccfd754de4b3d17c4793cd96ee41e4a5a1f65f..310345f0885e6b259de0380e01ab513f0e707c1e 100644 --- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c +++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c @@ -191,6 +191,8 @@ int main(int argc __attribute__((unused)), char *argv[]) if (maria_log_remove(maria_data_root)) exit(1); + free(long_buffer); + my_uuid_end(); my_free_open_file_info(); my_end(0); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 3a9bf45e22f5b5a3cc2169bd398eb79c257dee24..7f2afc3130a608811a89fa9ebe33614652388db2 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -729,6 +729,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) { MI_KEYDEF *keyinfo; MI_COLUMNDEF *recinfo= 0; + char readlink_buf[FN_REFLEN], name_buff[FN_REFLEN]; uint recs; uint i; @@ -783,6 +784,30 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) (void) mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0); info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + + /* + Set data_file_name and index_file_name to point at the symlink value + if table is symlinked (Ie; Real name is not same as generated name) + */ + fn_format(name_buff, file->filename, "", MI_NAME_DEXT, + MY_APPEND_EXT | MY_UNPACK_FILENAME); + if (my_is_symlink(name_buff)) + { + my_readlink(readlink_buf, name_buff, MYF(0)); + data_file_name= strdup_root(&table->mem_root, readlink_buf); + } + else + data_file_name= 0; + fn_format(name_buff, file->filename, "", MI_NAME_IEXT, + MY_APPEND_EXT | MY_UNPACK_FILENAME); + if (my_is_symlink(name_buff)) + { + my_readlink(readlink_buf, name_buff, MYF(0)); + index_file_name= strdup_root(&table->mem_root, readlink_buf); + } + else + index_file_name= 0; + if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED)) (void) mi_extra(file, HA_EXTRA_WAIT_LOCK, 0); if (!table->s->db_record_offset) @@ -1847,7 +1872,6 @@ void ha_myisam::position(const uchar *record) int ha_myisam::info(uint flag) { MI_ISAMINFO misam_info; - char name_buff[FN_REFLEN]; if (!table) return 1; @@ -1895,27 +1919,6 @@ int ha_myisam::info(uint flag) sizeof(table->key_info[0].rec_per_key[0])*share->key_parts); if (table_share->tmp_table == NO_TMP_TABLE) mysql_mutex_unlock(&table_share->LOCK_share); - - /* - Set data_file_name and index_file_name to point at the symlink value - if table is symlinked (Ie; Real name is not same as generated name) - */ - char buf[FN_REFLEN]; - data_file_name= index_file_name= 0; - fn_format(name_buff, file->filename, "", MI_NAME_DEXT, - MY_APPEND_EXT | MY_UNPACK_FILENAME); - if (my_is_symlink(name_buff)) - { - my_readlink(buf, name_buff, MYF(0)); - data_file_name= ha_thd()->strdup(buf); - } - fn_format(name_buff, file->filename, "", MI_NAME_IEXT, - MY_APPEND_EXT | MY_UNPACK_FILENAME); - if (my_is_symlink(name_buff)) - { - my_readlink(buf, name_buff, MYF(0)); - index_file_name= ha_thd()->strdup(buf); - } } if (flag & HA_STATUS_ERRKEY) { diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index 1921926463e0af40a96c1b5ca110078287508545..4fd287c60387843a967b0021915ebc12d5589012 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -1,5 +1,5 @@ -/* - Copyright (c) 2000, 2010, Oracle and/or its affiliates +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2009, 2018, 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 @@ -113,6 +113,8 @@ int mi_lock_database(MI_INFO *info, int lock_type) share->changed=0; if (myisam_flush) { + if (share->file_map) + my_msync(info->dfile, share->file_map, share->mmaped_length, MS_SYNC); if (mysql_file_sync(share->kfile, MYF(0))) mark_crashed= error= my_errno; if (mysql_file_sync(info->dfile, MYF(0))) @@ -526,6 +528,8 @@ int _mi_writeinfo(register MI_INFO *info, uint operation) #ifdef _WIN32 if (myisam_flush) { + if (share->file_map) + my_msync(info->dfile, share->file_map, share->mmaped_length, MS_SYNC); mysql_file_sync(share->kfile, 0); mysql_file_sync(info->dfile, 0); } diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 60a34c641ada5f6dd925fcb06f12ad9f95400165..92f28f4e32ab5acf327232030eae462c50c0518a 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -607,11 +607,11 @@ void _mi_kpointer(register MI_INFO *info, register uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; @@ -728,13 +728,13 @@ void _mi_dpointer(MI_INFO *info, uchar *buff, my_off_t pos) case 5: mi_int5store(buff,pos); break; #else case 8: *buff++=0; - /* fall trough */ + /* fall through */ case 7: *buff++=0; - /* fall trough */ + /* fall through */ case 6: *buff++=0; - /* fall trough */ + /* fall through */ case 5: *buff++=0; - /* fall trough */ + /* fall through */ #endif case 4: mi_int4store(buff,pos); break; case 3: mi_int3store(buff,pos); break; diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index f01c4aed4495476e0e8b576e27d02c9fcc10a312..7ea987280340cdefab2460de8da6755bea79b84d 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -1,7 +1,9 @@ -SET(TOKUDB_VERSION 5.6.37-82.2) +SET(TOKUDB_VERSION 5.6.38-83.0) # PerconaFT only supports x86-64 and cmake-2.8.9+ IF(CMAKE_VERSION VERSION_LESS "2.8.9") MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB") +ELSEIF(NOT HAVE_DLOPEN) + MESSAGE(STATUS "dlopen is required by TokuDB") ELSEIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64") # tokudb requires F_NOCACHE or O_DIRECT, and designated initializers diff --git a/storage/tokudb/PerconaFT/CMakeLists.txt b/storage/tokudb/PerconaFT/CMakeLists.txt index d42525f1089d7068312dc20af8f86bab54cc10a0..3973ec71b528ceada35f08b84fccacf6ed950015 100644 --- a/storage/tokudb/PerconaFT/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/CMakeLists.txt @@ -12,9 +12,14 @@ set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") # detect when we are being built as a subproject if (DEFINED MYSQL_PROJECT_NAME_DOCSTRING) add_definitions( -DMYSQL_TOKUDB_ENGINE=1) + # Extended PFS instrumentation: + # -DTOKU_PFS_MUTEX_EXTENDED_CACHETABLEMMUTEX=1 + if (WITH_PERFSCHEMA_STORAGE_ENGINE) + add_definitions(-DTOKU_MYSQL_WITH_PFS) + endif () + include_directories(${CMAKE_SOURCE_DIR}/include) if ((CMAKE_BUILD_TYPE MATCHES "Debug") AND (CMAKE_CXX_FLAGS_DEBUG MATCHES " -DENABLED_DEBUG_SYNC")) - include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_SOURCE_DIR}/sql) endif () endif () diff --git a/storage/tokudb/PerconaFT/buildheader/make_tdb.cc b/storage/tokudb/PerconaFT/buildheader/make_tdb.cc index 0fa876f2bd80ab707333c47d8cc1e86efe693f7a..95d6207eddabd05efb829f38d295225f8551e335 100644 --- a/storage/tokudb/PerconaFT/buildheader/make_tdb.cc +++ b/storage/tokudb/PerconaFT/buildheader/make_tdb.cc @@ -445,14 +445,15 @@ static void print_db_key_range_struct (void) { sort_and_dump_fields("db_key_range", false, NULL); } -static void print_db_lsn_struct (void) { - field_counter=0; - /* A dummy field to make sizeof(DB_LSN) equal in C and C++ */ - const char *extra[] = { "char dummy", NULL }; - sort_and_dump_fields("db_lsn", false, extra); +static void print_db_lsn_struct(void) { + field_counter = 0; + // FT-692 + STRUCT_SETUP(DB_LSN, file, "uint32_t %s"); + STRUCT_SETUP(DB_LSN, offset, "uint32_t %s"); + sort_and_dump_fields("db_lsn", false, NULL); } -static void print_dbt_struct (void) { +static void print_dbt_struct(void) { field_counter=0; #if 0 && DB_VERSION_MAJOR==4 && DB_VERSION_MINOR==1 STRUCT_SETUP(DBT, app_private, "void*%s"); diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake index 0cd9a9c594146c4d1a286fcd0298bcb8595e462f..385723aebc7b0a7048e4733363d91cf7025ae9aa 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake @@ -53,7 +53,13 @@ macro(set_cflags_if_supported) endforeach(flag) endmacro(set_cflags_if_supported) +if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING) + set (OPTIONAL_CFLAGS "${OPTIONAL_CFLAGS} -Wmissing-format-attribute") +endif() + ## disable some warnings +## missing-format-attribute causes warnings in some MySQL include files +## if the library is built as a part of TokuDB MySQL storage engine set_cflags_if_supported( -Wno-missing-field-initializers -Wstrict-null-sentinel @@ -61,7 +67,7 @@ set_cflags_if_supported( -Wswitch -Wtrampolines -Wlogical-op - -Wmissing-format-attribute + ${OPTIONAL_CFLAGS} -Wno-error=missing-format-attribute -Wno-error=address-of-array-temporary -Wno-error=tautological-constant-out-of-range-compare @@ -143,8 +149,8 @@ set_cflags_if_supported( -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith - -Wmissing-format-attribute -Wshadow + ${OPTIONAL_CFLAGS} ## other flags to try: #-Wunsafe-loop-optimizations #-Wpointer-arith diff --git a/storage/tokudb/PerconaFT/ft/cachetable/background_job_manager.cc b/storage/tokudb/PerconaFT/ft/cachetable/background_job_manager.cc index 9119a49b081022660fa3a7054c2cd5f975f51296..c109185f973c3071790d2a2779da0d04e76fa6c3 100644 --- a/storage/tokudb/PerconaFT/ft/cachetable/background_job_manager.cc +++ b/storage/tokudb/PerconaFT/ft/cachetable/background_job_manager.cc @@ -42,6 +42,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "cachetable/background_job_manager.h" +toku_instr_key *bjm_jobs_lock_mutex_key; +toku_instr_key *bjm_jobs_wait_key; + struct background_job_manager_struct { bool accepting_jobs; uint32_t num_jobs; @@ -49,10 +52,10 @@ struct background_job_manager_struct { toku_mutex_t jobs_lock; }; -void bjm_init(BACKGROUND_JOB_MANAGER* pbjm) { +void bjm_init(BACKGROUND_JOB_MANAGER *pbjm) { BACKGROUND_JOB_MANAGER XCALLOC(bjm); - toku_mutex_init(&bjm->jobs_lock, 0); - toku_cond_init(&bjm->jobs_wait, NULL); + toku_mutex_init(*bjm_jobs_lock_mutex_key, &bjm->jobs_lock, nullptr); + toku_cond_init(*bjm_jobs_wait_key, &bjm->jobs_wait, nullptr); bjm->accepting_jobs = true; bjm->num_jobs = 0; *pbjm = bjm; diff --git a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc index 31aab932fd6775f1c2e5fcc67d3c276d5c98b8ea..ae2bb2846e8a3c9874a8355d0e4ddc0643d9604d 100644 --- a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc +++ b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc @@ -57,6 +57,25 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/status.h" #include "util/context.h" +toku_instr_key *cachetable_m_mutex_key; +toku_instr_key *cachetable_ev_thread_lock_mutex_key; + +toku_instr_key *cachetable_m_list_lock_key; +toku_instr_key *cachetable_m_pending_lock_expensive_key; +toku_instr_key *cachetable_m_pending_lock_cheap_key; +toku_instr_key *cachetable_m_lock_key; + +toku_instr_key *cachetable_value_key; +toku_instr_key *cachetable_disk_nb_rwlock_key; + +toku_instr_key *cachetable_p_refcount_wait_key; +toku_instr_key *cachetable_m_flow_control_cond_key; +toku_instr_key *cachetable_m_ev_thread_cond_key; + +toku_instr_key *cachetable_disk_nb_mutex_key; +toku_instr_key *log_internal_lock_mutex_key; +toku_instr_key *eviction_thread_key; + /////////////////////////////////////////////////////////////////////////////////// // Engine status // @@ -779,18 +798,25 @@ void pair_init(PAIR p, p->checkpoint_complete_callback = write_callback.checkpoint_complete_callback; p->write_extraargs = write_callback.write_extraargs; - p->count = 0; // Is zero the correct init value? + p->count = 0; // Is zero the correct init value? p->refcount = 0; p->num_waiting_on_refs = 0; - toku_cond_init(&p->refcount_wait, NULL); + toku_cond_init(*cachetable_p_refcount_wait_key, &p->refcount_wait, nullptr); p->checkpoint_pending = false; p->mutex = list->get_mutex_for_pair(fullhash); assert(p->mutex); - p->value_rwlock.init(p->mutex); - nb_mutex_init(&p->disk_nb_mutex); + p->value_rwlock.init(p->mutex +#ifdef TOKU_MYSQL_WITH_PFS + , + *cachetable_value_key +#endif + ); + nb_mutex_init(*cachetable_disk_nb_mutex_key, + *cachetable_disk_nb_rwlock_key, + &p->disk_nb_mutex); - p->size_evicting_estimate = 0; // Is zero the correct init value? + p->size_evicting_estimate = 0; // Is zero the correct init value? p->ev = ev; p->list = list; @@ -3229,16 +3255,26 @@ void pair_list::init() { #if defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); #else - // TODO: need to figure out how to make writer-preferential rwlocks - // happen on osx +// TODO: need to figure out how to make writer-preferential rwlocks +// happen on osx #endif - toku_pthread_rwlock_init(&m_list_lock, &attr); - toku_pthread_rwlock_init(&m_pending_lock_expensive, &attr); - toku_pthread_rwlock_init(&m_pending_lock_cheap, &attr); + toku_pthread_rwlock_init(*cachetable_m_list_lock_key, &m_list_lock, &attr); + toku_pthread_rwlock_init(*cachetable_m_pending_lock_expensive_key, + &m_pending_lock_expensive, + &attr); + toku_pthread_rwlock_init( + *cachetable_m_pending_lock_cheap_key, &m_pending_lock_cheap, &attr); XCALLOC_N(m_table_size, m_table); XCALLOC_N(m_num_locks, m_mutexes); for (uint64_t i = 0; i < m_num_locks; i++) { - toku_mutex_init(&m_mutexes[i].aligned_mutex, NULL); + toku_mutex_init( +#ifdef TOKU_PFS_MUTEX_EXTENDED_CACHETABLEMMUTEX + *cachetable_m_mutex_key, +#else + toku_uninstrumented, +#endif + &m_mutexes[i].aligned_mutex, + nullptr); } } @@ -3578,9 +3614,9 @@ ENSURE_POD(evictor); // This is the function that runs eviction on its own thread. // static void *eviction_thread(void *evictor_v) { - evictor* CAST_FROM_VOIDP(evictor, evictor_v); + evictor *CAST_FROM_VOIDP(evictor, evictor_v); evictor->run_eviction_thread(); - return evictor_v; + return toku_pthread_done(evictor_v); } // @@ -3629,11 +3665,14 @@ int evictor::init(long _size_limit, pair_list* _pl, cachefile_list* _cf_list, KI m_pl = _pl; m_cf_list = _cf_list; - m_kibbutz = _kibbutz; - toku_mutex_init(&m_ev_thread_lock, NULL); - toku_cond_init(&m_flow_control_cond, NULL); - toku_cond_init(&m_ev_thread_cond, NULL); - m_num_sleepers = 0; + m_kibbutz = _kibbutz; + toku_mutex_init( + *cachetable_ev_thread_lock_mutex_key, &m_ev_thread_lock, nullptr); + toku_cond_init( + *cachetable_m_flow_control_cond_key, &m_flow_control_cond, nullptr); + toku_cond_init( + *cachetable_m_ev_thread_cond_key, &m_ev_thread_cond, nullptr); + m_num_sleepers = 0; m_ev_thread_is_running = false; m_period_in_seconds = eviction_period; @@ -3641,11 +3680,12 @@ int evictor::init(long _size_limit, pair_list* _pl, cachefile_list* _cf_list, KI int r = myinitstate_r(seed, m_random_statebuf, sizeof m_random_statebuf, &m_random_data); assert_zero(r); - // start the background thread + // start the background thread m_run_thread = true; m_num_eviction_thread_runs = 0; m_ev_thread_init = false; - r = toku_pthread_create(&m_ev_thread, NULL, eviction_thread, this); + r = toku_pthread_create( + *eviction_thread_key, &m_ev_thread, nullptr, eviction_thread, this); if (r == 0) { m_ev_thread_init = true; } @@ -4702,7 +4742,7 @@ static_assert(std::is_pod::value, "cachefile_list isn't POD"); void cachefile_list::init() { m_next_filenum_to_use.fileid = 0; m_next_hash_id_to_use = 0; - toku_pthread_rwlock_init(&m_lock, NULL); + toku_pthread_rwlock_init(*cachetable_m_lock_key, &m_lock, nullptr); m_active_filenum.create(); m_active_fileid.create(); m_stale_fileid.create(); diff --git a/storage/tokudb/PerconaFT/ft/cachetable/checkpoint.cc b/storage/tokudb/PerconaFT/ft/cachetable/checkpoint.cc index 3223ab0a4ce8a2df7df381119a59a43b6ef4421c..13ff5eff5af574a8ef85feb837205dc57a0907a1 100644 --- a/storage/tokudb/PerconaFT/ft/cachetable/checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/cachetable/checkpoint.cc @@ -86,8 +86,16 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/frwlock.h" #include "util/status.h" -void -toku_checkpoint_get_status(CACHETABLE ct, CHECKPOINT_STATUS statp) { +toku_instr_key *checkpoint_safe_mutex_key; +toku_instr_key *checkpoint_safe_rwlock_key; +toku_instr_key *multi_operation_lock_key; +toku_instr_key *low_priority_multi_operation_lock_key; + +toku_instr_key *rwlock_cond_key; +toku_instr_key *rwlock_wait_read_key; +toku_instr_key *rwlock_wait_write_key; + +void toku_checkpoint_get_status(CACHETABLE ct, CHECKPOINT_STATUS statp) { cp_status.init(); CP_STATUS_VAL(CP_PERIOD) = toku_get_checkpoint_period_unlocked(ct); *statp = cp_status; @@ -116,11 +124,14 @@ multi_operation_lock_init(void) { #if defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP) pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); #else - // TODO: need to figure out how to make writer-preferential rwlocks - // happen on osx +// TODO: need to figure out how to make writer-preferential rwlocks +// happen on osx #endif - toku_pthread_rwlock_init(&multi_operation_lock, &attr); - toku_pthread_rwlock_init(&low_priority_multi_operation_lock, &attr); + toku_pthread_rwlock_init( + *multi_operation_lock_key, &multi_operation_lock, &attr); + toku_pthread_rwlock_init(*low_priority_multi_operation_lock_key, + &low_priority_multi_operation_lock, + &attr); pthread_rwlockattr_destroy(&attr); locked_mo = false; } @@ -145,10 +156,15 @@ multi_operation_checkpoint_unlock(void) { toku_pthread_rwlock_wrunlock(&low_priority_multi_operation_lock); } -static void -checkpoint_safe_lock_init(void) { - toku_mutex_init(&checkpoint_safe_mutex, NULL); - checkpoint_safe_lock.init(&checkpoint_safe_mutex); +static void checkpoint_safe_lock_init(void) { + toku_mutex_init( + *checkpoint_safe_mutex_key, &checkpoint_safe_mutex, nullptr); + checkpoint_safe_lock.init(&checkpoint_safe_mutex +#ifdef TOKU_MYSQL_WITH_PFS + , + *checkpoint_safe_rwlock_key +#endif + ); locked_cs = false; } diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.cc b/storage/tokudb/PerconaFT/ft/ft-ops.cc index 07e244947e4f459b6d9d334313642e8056dbaf11..60885ed9f33b153934ab38ac348435a6b611a06b 100644 --- a/storage/tokudb/PerconaFT/ft/ft-ops.cc +++ b/storage/tokudb/PerconaFT/ft/ft-ops.cc @@ -186,9 +186,35 @@ basement nodes, bulk fetch, and partial fetch: */ static toku_mutex_t ft_open_close_lock; - -void -toku_ft_get_status(FT_STATUS s) { +static toku_instr_key *ft_open_close_lock_mutex_key; +// FIXME: the instrumentation keys below are defined here even though they +// belong to other modules, because they are registered here. If desired, they +// can be moved to their proper modules and registration done there in a +// one-time init function +// locktree +toku_instr_key *treenode_mutex_key; +toku_instr_key *manager_mutex_key; +toku_instr_key *manager_escalation_mutex_key; +toku_instr_key *manager_escalator_mutex_key; +// src +toku_instr_key *db_txn_struct_i_txn_mutex_key; +toku_instr_key *indexer_i_indexer_lock_mutex_key; +toku_instr_key *indexer_i_indexer_estimate_lock_mutex_key; +toku_instr_key *result_i_open_dbs_rwlock_key; +// locktree +toku_instr_key *lock_request_m_wait_cond_key; +toku_instr_key *manager_m_escalator_done_key; +toku_instr_key *locktree_request_info_mutex_key; +toku_instr_key *locktree_request_info_retry_mutex_key; +toku_instr_key *locktree_request_info_retry_cv_key; + +// this is a sample probe for custom instrumentation +static toku_instr_key *fti_probe_1_key; + +// This is a sample probe for custom instrumentation +toku_instr_probe *toku_instr_probe_1; + +void toku_ft_get_status(FT_STATUS s) { ft_status.init(); *s = ft_status; @@ -2643,11 +2669,14 @@ void toku_ft_set_direct_io (bool direct_io_on) { use_direct_io = direct_io_on; } -static inline int ft_open_maybe_direct(const char *filename, int oflag, int mode) { +static inline int ft_open_maybe_direct(const char *filename, + int oflag, + int mode) { if (use_direct_io) { - return toku_os_open_direct(filename, oflag, mode); + return toku_os_open_direct( + filename, oflag, mode, *tokudb_file_data_key); } else { - return toku_os_open(filename, oflag, mode); + return toku_os_open(filename, oflag, mode, *tokudb_file_data_key); } } @@ -2721,7 +2750,7 @@ bool toku_create_subdirs_if_needed(const char *path) { if (!subdir.get()) return true; - if (toku_stat(subdir.get(), &stat) == -1) { + if (toku_stat(subdir.get(), &stat, toku_uninstrumented) == -1) { if (ENOENT == get_error_errno()) subdir_exists = false; else @@ -2933,6 +2962,8 @@ ft_handle_open(FT_HANDLE ft_h, const char *fname_in_env, int is_create, int only CACHEFILE cf = NULL; FT ft = NULL; bool did_create = false; + bool was_already_open = false; + toku_ft_open_close_lock(); if (ft_h->did_set_flags) { @@ -2944,7 +2975,6 @@ ft_handle_open(FT_HANDLE ft_h, const char *fname_in_env, int is_create, int only FILENUM reserved_filenum; reserved_filenum = use_filenum; fname_in_cwd = toku_cachetable_get_fname_in_cwd(cachetable, fname_in_env); - bool was_already_open; { int fd = -1; r = ft_open_file(fname_in_cwd, &fd); @@ -4614,20 +4644,265 @@ int toku_dump_ft(FILE *f, FT_HANDLE ft_handle) { return toku_dump_ftnode(f, ft_handle, root_key, 0, 0, 0); } + +static void toku_pfs_keys_init(const char *toku_instr_group_name) { + kibbutz_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, "kibbutz_mutex"); + minicron_p_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "minicron_p_mutex"); + queue_result_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "queue_result_mutex"); + tpool_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "tpool_lock_mutex"); + workset_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "workset_lock_mutex"); + bjm_jobs_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "bjm_jobs_lock_mutex"); + log_internal_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "log_internal_lock_mutex"); + cachetable_ev_thread_lock_mutex_key = + new toku_instr_key(toku_instr_object_type::mutex, + toku_instr_group_name, + "cachetable_ev_thread_lock_mutex"); + cachetable_disk_nb_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "cachetable_disk_nb_mutex"); + safe_file_size_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "safe_file_size_lock_mutex"); + cachetable_m_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "cachetable_m_mutex_key"); + checkpoint_safe_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "checkpoint_safe_mutex"); + ft_ref_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "ft_ref_lock_mutex"); + ft_open_close_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "ft_open_close_lock_mutex"); + loader_error_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "loader_error_mutex"); + bfs_mutex_key = + new toku_instr_key(toku_instr_object_type::mutex, toku_instr_group_name, + "bfs_mutex"); + loader_bl_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "loader_bl_mutex"); + loader_fi_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "loader_fi_lock_mutex"); + loader_out_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "loader_out_mutex"); + result_output_condition_lock_mutex_key = + new toku_instr_key(toku_instr_object_type::mutex, + toku_instr_group_name, + "result_output_condition_lock_mutex"); + block_table_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "block_table_mutex"); + rollback_log_node_cache_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "rollback_log_node_cache_mutex"); + txn_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, "txn_lock_mutex"); + txn_state_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "txn_state_lock_mutex"); + txn_child_manager_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "txn_child_manager_mutex"); + txn_manager_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "txn_manager_lock_mutex"); + treenode_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, "treenode_mutex"); + locktree_request_info_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "locktree_request_info_mutex"); + locktree_request_info_retry_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "locktree_request_info_retry_mutex_key"); + manager_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, "manager_mutex"); + manager_escalation_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "manager_escalation_mutex"); + db_txn_struct_i_txn_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "db_txn_struct_i_txn_mutex"); + manager_escalator_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "manager_escalator_mutex"); + indexer_i_indexer_lock_mutex_key = new toku_instr_key( + toku_instr_object_type::mutex, toku_instr_group_name, + "indexer_i_indexer_lock_mutex"); + indexer_i_indexer_estimate_lock_mutex_key = + new toku_instr_key(toku_instr_object_type::mutex, + toku_instr_group_name, + "indexer_i_indexer_estimate_lock_mutex"); + + tokudb_file_data_key = new toku_instr_key( + toku_instr_object_type::file, toku_instr_group_name, "tokudb_data_file"); + tokudb_file_load_key = new toku_instr_key( + toku_instr_object_type::file, toku_instr_group_name, "tokudb_load_file"); + tokudb_file_tmp_key = new toku_instr_key( + toku_instr_object_type::file, toku_instr_group_name, "tokudb_tmp_file"); + tokudb_file_log_key = new toku_instr_key( + toku_instr_object_type::file, toku_instr_group_name, "tokudb_log_file"); + + fti_probe_1_key = + new toku_instr_key(toku_instr_object_type::mutex, toku_instr_group_name, + "fti_probe_1"); + + extractor_thread_key = new toku_instr_key( + toku_instr_object_type::thread, toku_instr_group_name, + "extractor_thread"); + fractal_thread_key = new toku_instr_key( + toku_instr_object_type::thread, toku_instr_group_name, "fractal_thread"); + io_thread_key = + new toku_instr_key(toku_instr_object_type::thread, toku_instr_group_name, + "io_thread"); + eviction_thread_key = new toku_instr_key( + toku_instr_object_type::thread, toku_instr_group_name, + "eviction_thread"); + kibbutz_thread_key = new toku_instr_key( + toku_instr_object_type::thread, toku_instr_group_name, "kibbutz_thread"); + minicron_thread_key = new toku_instr_key( + toku_instr_object_type::thread, toku_instr_group_name, + "minicron_thread"); + tp_internal_thread_key = new toku_instr_key( + toku_instr_object_type::thread, toku_instr_group_name, + "tp_internal_thread"); + + result_state_cond_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "result_state_cond"); + bjm_jobs_wait_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, "bjm_jobs_wait"); + cachetable_p_refcount_wait_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "cachetable_p_refcount_wait"); + cachetable_m_flow_control_cond_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "cachetable_m_flow_control_cond"); + cachetable_m_ev_thread_cond_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "cachetable_m_ev_thread_cond"); + bfs_cond_key = + new toku_instr_key(toku_instr_object_type::cond, toku_instr_group_name, + "bfs_cond"); + result_output_condition_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "result_output_condition"); + manager_m_escalator_done_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "manager_m_escalator_done"); + lock_request_m_wait_cond_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "lock_request_m_wait_cond"); + queue_result_cond_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "queue_result_cond"); + ws_worker_wait_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, "ws_worker_wait"); + rwlock_wait_read_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, "rwlock_wait_read"); + rwlock_wait_write_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "rwlock_wait_write"); + rwlock_cond_key = + new toku_instr_key(toku_instr_object_type::cond, toku_instr_group_name, + "rwlock_cond"); + tp_thread_wait_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, "tp_thread_wait"); + tp_pool_wait_free_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "tp_pool_wait_free"); + frwlock_m_wait_read_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "frwlock_m_wait_read"); + kibbutz_k_cond_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, "kibbutz_k_cond"); + minicron_p_condvar_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "minicron_p_condvar"); + locktree_request_info_retry_cv_key = new toku_instr_key( + toku_instr_object_type::cond, toku_instr_group_name, + "locktree_request_info_retry_cv_key"); + + multi_operation_lock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "multi_operation_lock"); + low_priority_multi_operation_lock_key = + new toku_instr_key(toku_instr_object_type::rwlock, + toku_instr_group_name, + "low_priority_multi_operation_lock"); + cachetable_m_list_lock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "cachetable_m_list_lock"); + cachetable_m_pending_lock_expensive_key = + new toku_instr_key(toku_instr_object_type::rwlock, + toku_instr_group_name, + "cachetable_m_pending_lock_expensive"); + cachetable_m_pending_lock_cheap_key = + new toku_instr_key(toku_instr_object_type::rwlock, + toku_instr_group_name, + "cachetable_m_pending_lock_cheap"); + cachetable_m_lock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "cachetable_m_lock"); + result_i_open_dbs_rwlock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "result_i_open_dbs_rwlock"); + checkpoint_safe_rwlock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "checkpoint_safe_rwlock"); + cachetable_value_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "cachetable_value"); + safe_file_size_lock_rwlock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "safe_file_size_lock_rwlock"); + cachetable_disk_nb_rwlock_key = new toku_instr_key( + toku_instr_object_type::rwlock, toku_instr_group_name, + "cachetable_disk_nb_rwlock"); + + toku_instr_probe_1 = new toku_instr_probe(*fti_probe_1_key); +} + int toku_ft_layer_init(void) { int r = 0; - //Portability must be initialized first + + // Portability must be initialized first r = toku_portability_init(); - if (r) { goto exit; } + if (r) { + goto exit; + } + + toku_pfs_keys_init("fti"); + r = db_env_set_toku_product_name("tokudb"); - if (r) { goto exit; } + if (r) { + goto exit; + } partitioned_counters_init(); toku_status_init(); toku_context_status_init(); toku_checkpoint_init(); toku_ft_serialize_layer_init(); - toku_mutex_init(&ft_open_close_lock, NULL); + toku_mutex_init( + *ft_open_close_lock_mutex_key, &ft_open_close_lock, nullptr); toku_scoped_malloc_init(); exit: return r; @@ -4641,7 +4916,10 @@ void toku_ft_layer_destroy(void) { toku_status_destroy(); partitioned_counters_destroy(); toku_scoped_malloc_destroy(); - //Portability must be cleaned up last + + delete toku_instr_probe_1; + + // Portability must be cleaned up last toku_portability_destroy(); } diff --git a/storage/tokudb/PerconaFT/ft/ft.cc b/storage/tokudb/PerconaFT/ft/ft.cc index 700e532d5cf4e4532f71c120f102c469be20ca25..454bf11794fe4b139a4495ea22b06e651de5ecea 100644 --- a/storage/tokudb/PerconaFT/ft/ft.cc +++ b/storage/tokudb/PerconaFT/ft/ft.cc @@ -50,9 +50,10 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include #include -void -toku_reset_root_xid_that_created(FT ft, TXNID new_root_xid_that_created) { - // Reset the root_xid_that_created field to the given value. +toku_instr_key *ft_ref_lock_mutex_key; + +void toku_reset_root_xid_that_created(FT ft, TXNID new_root_xid_that_created) { + // Reset the root_xid_that_created field to the given value. // This redefines which xid created the dictionary. // hold lock around setting and clearing of dirty bit @@ -100,15 +101,11 @@ toku_ft_free (FT ft) { toku_free(ft); } -void -toku_ft_init_reflock(FT ft) { - toku_mutex_init(&ft->ft_ref_lock, NULL); +void toku_ft_init_reflock(FT ft) { + toku_mutex_init(*ft_ref_lock_mutex_key, &ft->ft_ref_lock, nullptr); } -void -toku_ft_destroy_reflock(FT ft) { - toku_mutex_destroy(&ft->ft_ref_lock); -} +void toku_ft_destroy_reflock(FT ft) { toku_mutex_destroy(&ft->ft_ref_lock); } void toku_ft_grab_reflock(FT ft) { diff --git a/storage/tokudb/PerconaFT/ft/loader/callbacks.cc b/storage/tokudb/PerconaFT/ft/loader/callbacks.cc index 6a520dba3a3ec984a490fd10840c5509d0b3c097..ac69fb7e7891892a886182001b528a7f6a955148 100644 --- a/storage/tokudb/PerconaFT/ft/loader/callbacks.cc +++ b/storage/tokudb/PerconaFT/ft/loader/callbacks.cc @@ -45,6 +45,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "loader/loader-internal.h" #include "util/dbt.h" +toku_instr_key *loader_error_mutex_key; + static void error_callback_lock(ft_loader_error_callback loader_error) { toku_mutex_lock(&loader_error->mutex); } @@ -57,10 +59,10 @@ void ft_loader_init_error_callback(ft_loader_error_callback loader_error) { memset(loader_error, 0, sizeof *loader_error); toku_init_dbt(&loader_error->key); toku_init_dbt(&loader_error->val); - toku_mutex_init(&loader_error->mutex, NULL); + toku_mutex_init(*loader_error_mutex_key, &loader_error->mutex, nullptr); } -void ft_loader_destroy_error_callback(ft_loader_error_callback loader_error) { +void ft_loader_destroy_error_callback(ft_loader_error_callback loader_error) { toku_mutex_destroy(&loader_error->mutex); toku_destroy_dbt(&loader_error->key); toku_destroy_dbt(&loader_error->val); diff --git a/storage/tokudb/PerconaFT/ft/loader/dbufio.cc b/storage/tokudb/PerconaFT/ft/loader/dbufio.cc index 28d8d49ba9fac387f43131800928e484bd86db11..9ff712bcbaef5cbbff2e1cedfed8fdf2a19b5655 100644 --- a/storage/tokudb/PerconaFT/ft/loader/dbufio.cc +++ b/storage/tokudb/PerconaFT/ft/loader/dbufio.cc @@ -48,6 +48,10 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "loader/dbufio.h" #include "loader/loader-internal.h" +toku_instr_key *bfs_mutex_key; +toku_instr_key *bfs_cond_key; +toku_instr_key *io_thread_key; + struct dbufio_file { // i/o thread owns these int fd; @@ -275,39 +279,44 @@ static void* io_thread (void *v) toku_mutex_lock(&bfs->mutex); //printf("%s:%d Locked\n", __FILE__, __LINE__); while (1) { + if (paniced(bfs)) { + toku_mutex_unlock(&bfs->mutex); // ignore any error + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); + } + // printf("n_not_done=%d\n", bfs->n_not_done); + if (bfs->n_not_done == 0) { + // all done (meaning we stored EOF (or another error) in + // error_code[0] for the file. + // printf("unlocked\n"); + toku_mutex_unlock(&bfs->mutex); + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); + } - if (paniced(bfs)) { - toku_mutex_unlock(&bfs->mutex); // ignore any error - return 0; - } - //printf("n_not_done=%d\n", bfs->n_not_done); - if (bfs->n_not_done==0) { - // all done (meaning we stored EOF (or another error) in error_code[0] for the file. - //printf("unlocked\n"); - toku_mutex_unlock(&bfs->mutex); - return 0; - } - - struct dbufio_file *dbf = bfs->head; - if (dbf==NULL) { - // No I/O needs to be done yet. - // Wait until something happens that will wake us up. - toku_cond_wait(&bfs->cond, &bfs->mutex); - if (paniced(bfs)) { - toku_mutex_unlock(&bfs->mutex); // ignore any error - return 0; - } - // Have the lock so go around. - } else { - // Some I/O needs to be done. - //printf("%s:%d Need I/O\n", __FILE__, __LINE__); - assert(dbf->second_buf_ready == false); - assert(!dbf->io_done); - bfs->head = dbf->next; - if (bfs->head==NULL) bfs->tail=NULL; - - // Unlock the mutex now that we have ownership of dbf to allow consumers to get the mutex and perform swaps. They won't swap - // this buffer because second_buf_ready is false. + struct dbufio_file *dbf = bfs->head; + if (dbf == NULL) { + // No I/O needs to be done yet. + // Wait until something happens that will wake us up. + toku_cond_wait(&bfs->cond, &bfs->mutex); + if (paniced(bfs)) { + toku_mutex_unlock(&bfs->mutex); // ignore any error + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); + } + // Have the lock so go around. + } else { + // Some I/O needs to be done. + // printf("%s:%d Need I/O\n", __FILE__, __LINE__); + assert(dbf->second_buf_ready == false); + assert(!dbf->io_done); + bfs->head = dbf->next; + if (bfs->head == NULL) + bfs->tail = NULL; + + // Unlock the mutex now that we have ownership of dbf to allow + // consumers to get the mutex and perform swaps. They won't swap + // this buffer because second_buf_ready is false. toku_mutex_unlock(&bfs->mutex); //printf("%s:%d Doing read fd=%d\n", __FILE__, __LINE__, dbf->fd); { @@ -338,14 +347,16 @@ static void* io_thread (void *v) //printf("%s:%d locking mutex again=%ld\n", __FILE__, __LINE__, readcode); { - toku_mutex_lock(&bfs->mutex); - if (paniced(bfs)) { - toku_mutex_unlock(&bfs->mutex); // ignore any error - return 0; - } - } - // Now that we have the mutex, we can decrement n_not_done (if applicable) and set second_buf_ready - if (readcode<=0) { + toku_mutex_lock(&bfs->mutex); + if (paniced(bfs)) { + toku_mutex_unlock(&bfs->mutex); // ignore any error + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); + } + } + // Now that we have the mutex, we can decrement n_not_done (if + // applicable) and set second_buf_ready + if (readcode<=0) { bfs->n_not_done--; } //printf("%s:%d n_not_done=%d\n", __FILE__, __LINE__, bfs->n_not_done); @@ -376,34 +387,36 @@ int create_dbufio_fileset (DBUFIO_FILESET *bfsp, int N, int fds[/*N*/], size_t b } } } - //printf("%s:%d here\n", __FILE__, __LINE__); - if (result==0) { - toku_mutex_init(&bfs->mutex, NULL); - mutex_inited = true; + // printf("%s:%d here\n", __FILE__, __LINE__); + if (result == 0) { + toku_mutex_init(*bfs_mutex_key, &bfs->mutex, nullptr); + mutex_inited = true; } - if (result==0) { - toku_cond_init(&bfs->cond, NULL); - cond_inited = true; + if (result == 0) { + toku_cond_init(*bfs_cond_key, &bfs->cond, nullptr); + cond_inited = true; } - if (result==0) { - bfs->N = N; - bfs->n_not_done = N; - bfs->head = bfs->tail = NULL; - for (int i=0; ifiles[i].fd = fds[i]; - bfs->files[i].offset_in_buf = 0; - bfs->files[i].offset_in_uncompressed_file = 0; - bfs->files[i].next = NULL; - bfs->files[i].second_buf_ready = false; - for (int j=0; j<2; j++) { - if (result==0) { - MALLOC_N(bufsize, bfs->files[i].buf[j]); - if (bfs->files[i].buf[j]==NULL) { result=get_error_errno(); } - } - bfs->files[i].n_in_buf[j] = 0; - bfs->files[i].error_code[j] = 0; - } - bfs->files[i].io_done = false; + if (result == 0) { + bfs->N = N; + bfs->n_not_done = N; + bfs->head = bfs->tail = NULL; + for (int i = 0; i < N; i++) { + bfs->files[i].fd = fds[i]; + bfs->files[i].offset_in_buf = 0; + bfs->files[i].offset_in_uncompressed_file = 0; + bfs->files[i].next = NULL; + bfs->files[i].second_buf_ready = false; + for (int j = 0; j < 2; j++) { + if (result == 0) { + MALLOC_N(bufsize, bfs->files[i].buf[j]); + if (bfs->files[i].buf[j] == NULL) { + result = get_error_errno(); + } + } + bfs->files[i].n_in_buf[j] = 0; + bfs->files[i].error_code[j] = 0; + } + bfs->files[i].io_done = false; ssize_t r; if (bfs->compressed) { r = dbf_read_compressed(&bfs->files[i], bfs->files[i].buf[0], bufsize); @@ -430,13 +443,21 @@ int create_dbufio_fileset (DBUFIO_FILESET *bfsp, int N, int fds[/*N*/], size_t b bfs->panic = false; bfs->panic_errno = 0; } - //printf("Creating IO thread\n"); - if (result==0) { - result = toku_pthread_create(&bfs->iothread, NULL, io_thread, (void*)bfs); + // printf("Creating IO thread\n"); + if (result == 0) { + result = toku_pthread_create(*io_thread_key, + &bfs->iothread, + nullptr, + io_thread, + static_cast(bfs)); + } + if (result == 0) { + *bfsp = bfs; + return 0; } - if (result==0) { *bfsp = bfs; return 0; } // Now undo everything. - // If we got here, there is no thread (either result was zero before the thread was created, or else the thread creation itself failed. + // If we got here, there is no thread (either result was zero before the + // thread was created, or else the thread creation itself failed. if (bfs) { if (bfs->files) { // the files were allocated, so we have to free all the bufs. diff --git a/storage/tokudb/PerconaFT/ft/loader/loader-internal.h b/storage/tokudb/PerconaFT/ft/loader/loader-internal.h index 1aa2c20383150f0c44e2790e5a9f85b37f8cd72f..6f7b0147b212afad457c4b3e7728311a5d7b3acf 100644 --- a/storage/tokudb/PerconaFT/ft/loader/loader-internal.h +++ b/storage/tokudb/PerconaFT/ft/loader/loader-internal.h @@ -64,10 +64,10 @@ enum { /* These structures maintain a collection of all the open temporary files used by the loader. */ struct file_info { bool is_open; - bool is_extant; // if true, the file must be unlinked. + bool is_extant; // if true, the file must be unlinked. char *fname; - FILE *file; - uint64_t n_rows; // how many rows were written into that file + TOKU_FILE *file; + uint64_t n_rows; // how many rows were written into that file size_t buffer_size; void *buffer; }; @@ -80,11 +80,11 @@ struct file_infos { }; typedef struct fidx { int idx; } FIDX; static const FIDX FIDX_NULL __attribute__((__unused__)) = {-1}; -static int fidx_is_null (const FIDX f) __attribute__((__unused__)); -static int fidx_is_null (const FIDX f) { return f.idx==-1; } -FILE *toku_bl_fidx2file (FTLOADER bl, FIDX i); +static int fidx_is_null(const FIDX f) __attribute__((__unused__)); +static int fidx_is_null(const FIDX f) { return f.idx == -1; } +TOKU_FILE *toku_bl_fidx2file(FTLOADER bl, FIDX i); -int ft_loader_open_temp_file (FTLOADER bl, FIDX*file_idx); +int ft_loader_open_temp_file(FTLOADER bl, FIDX *file_idx); /* These data structures are used for manipulating a collection of rows in main memory. */ struct row { @@ -100,11 +100,17 @@ struct rowset { }; int init_rowset (struct rowset *rows, uint64_t memory_budget); -void destroy_rowset (struct rowset *rows); -int add_row (struct rowset *rows, DBT *key, DBT *val); - -int loader_write_row(DBT *key, DBT *val, FIDX data, FILE*, uint64_t *dataoff, struct wbuf *wb, FTLOADER bl); -int loader_read_row (FILE *f, DBT *key, DBT *val); +void destroy_rowset(struct rowset *rows); +int add_row(struct rowset *rows, DBT *key, DBT *val); + +int loader_write_row(DBT *key, + DBT *val, + FIDX data, + TOKU_FILE *, + uint64_t *dataoff, + struct wbuf *wb, + FTLOADER bl); +int loader_read_row(TOKU_FILE *f, DBT *key, DBT *val); struct merge_fileset { bool have_sorted_output; // Is there an previous key? @@ -195,12 +201,13 @@ struct ft_loader_s { bool did_reserve_memory; bool compress_intermediates; bool allow_puts; - uint64_t reserved_memory; // how much memory are we allowed to use? + uint64_t reserved_memory; // how much memory are we allowed to use? - /* To make it easier to recover from errors, we don't use FILE*, instead we use an index into the file_infos. */ + /* To make it easier to recover from errors, we don't use TOKU_FILE*, + * instead we use an index into the file_infos. */ struct file_infos file_infos; -#define PROGRESS_MAX (1<<16) +#define PROGRESS_MAX (1 << 16) int progress; // Progress runs from 0 to PROGRESS_MAX. When we call the poll function we convert to a float from 0.0 to 1.0 // We use an integer so that we can add to the progress using a fetch-and-add instruction. diff --git a/storage/tokudb/PerconaFT/ft/loader/loader.cc b/storage/tokudb/PerconaFT/ft/loader/loader.cc index 528c86a8f79bfdec0bd90f62ea49e8b88c86e60c..9528af95627305e67364fb0ebcfed1b0c3627324 100644 --- a/storage/tokudb/PerconaFT/ft/loader/loader.cc +++ b/storage/tokudb/PerconaFT/ft/loader/loader.cc @@ -62,21 +62,17 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/x1764.h" -static size_t (*os_fwrite_fun)(const void *,size_t,size_t,FILE*)=NULL; -void ft_loader_set_os_fwrite (size_t (*fwrite_fun)(const void*,size_t,size_t,FILE*)) { - os_fwrite_fun=fwrite_fun; -} +toku_instr_key *loader_bl_mutex_key; +toku_instr_key *loader_fi_lock_mutex_key; +toku_instr_key *loader_out_mutex_key; -static size_t do_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream) { - if (os_fwrite_fun) { - return os_fwrite_fun(ptr, size, nmemb, stream); - } else { - return fwrite(ptr, size, nmemb, stream); - } -} +toku_instr_key *extractor_thread_key; +toku_instr_key *fractal_thread_key; +toku_instr_key *tokudb_file_tmp_key; +toku_instr_key *tokudb_file_load_key; -// 1024 is the right size_factor for production. +// 1024 is the right size_factor for production. // Different values for these sizes may be used for testing. static uint32_t size_factor = 1024; static uint32_t default_loader_nodesize = FT_DEFAULT_NODE_SIZE; @@ -98,7 +94,7 @@ toku_ft_loader_get_rowset_budget_for_testing (void) void ft_loader_lock_init(FTLOADER bl) { invariant(!bl->mutex_init); - toku_mutex_init(&bl->mutex, NULL); + toku_mutex_init(*loader_bl_mutex_key, &bl->mutex, nullptr); bl->mutex_init = true; } @@ -130,7 +126,10 @@ static int add_big_buffer(struct file_info *file) { newbuffer = true; } if (result == 0) { - int r = setvbuf(file->file, (char *) file->buffer, _IOFBF, file->buffer_size); + int r = setvbuf(file->file->file, + static_cast(file->buffer), + _IOFBF, + file->buffer_size); if (r != 0) { result = get_error_errno(); if (newbuffer) { @@ -149,9 +148,9 @@ static void cleanup_big_buffer(struct file_info *file) { } } -int ft_loader_init_file_infos (struct file_infos *fi) { +int ft_loader_init_file_infos(struct file_infos *fi) { int result = 0; - toku_mutex_init(&fi->lock, NULL); + toku_mutex_init(*loader_fi_lock_mutex_key, &fi->lock, nullptr); fi->n_files = 0; fi->n_files_limit = 1; fi->n_files_open = 0; @@ -195,11 +194,10 @@ void ft_loader_fi_destroy (struct file_infos *fi, bool is_error) fi->file_infos = NULL; } -static int open_file_add (struct file_infos *fi, - FILE *file, - char *fname, - /* out */ FIDX *idx) -{ +static int open_file_add(struct file_infos *fi, + TOKU_FILE *file, + char *fname, + /* out */ FIDX *idx) { int result = 0; toku_mutex_lock(&fi->lock); if (fi->n_files >= fi->n_files_limit) { @@ -229,11 +227,12 @@ int ft_loader_fi_reopen (struct file_infos *fi, FIDX idx, const char *mode) { int result = 0; toku_mutex_lock(&fi->lock); int i = idx.idx; - invariant(i>=0 && in_files); + invariant(i >= 0 && i < fi->n_files); invariant(!fi->file_infos[i].is_open); invariant(fi->file_infos[i].is_extant); - fi->file_infos[i].file = toku_os_fopen(fi->file_infos[i].fname, mode); - if (fi->file_infos[i].file == NULL) { + fi->file_infos[i].file = + toku_os_fopen(fi->file_infos[i].fname, mode, *tokudb_file_load_key); + if (fi->file_infos[i].file == NULL) { result = get_error_errno(); } else { fi->file_infos[i].is_open = true; @@ -306,20 +305,20 @@ int ft_loader_open_temp_file (FTLOADER bl, FIDX *file_idx) */ { int result = 0; - if (result) // debug hack + if (result) // debug hack return result; - FILE *f = NULL; + TOKU_FILE *f = NULL; int fd = -1; - char *fname = toku_strdup(bl->temp_file_template); + char *fname = toku_strdup(bl->temp_file_template); if (fname == NULL) result = get_error_errno(); else { fd = mkstemp(fname); - if (fd < 0) { + if (fd < 0) { result = get_error_errno(); } else { - f = toku_os_fdopen(fd, "r+"); - if (f == NULL) + f = toku_os_fdopen(fd, "r+", fname, *tokudb_file_tmp_key); + if (f->file == nullptr) result = get_error_errno(); else result = open_file_add(&bl->file_infos, f, fname, file_idx); @@ -338,7 +337,7 @@ int ft_loader_open_temp_file (FTLOADER bl, FIDX *file_idx) return result; } -void toku_ft_loader_internal_destroy (FTLOADER bl, bool is_error) { +void toku_ft_loader_internal_destroy(FTLOADER bl, bool is_error) { ft_loader_lock_destroy(bl); // These frees rely on the fact that if you free a NULL pointer then nothing bad happens. @@ -634,12 +633,16 @@ int toku_ft_loader_open (FTLOADER *blp, /* out */ allow_puts); if (r!=0) result = r; } - if (result==0 && allow_puts) { + if (result == 0 && allow_puts) { FTLOADER bl = *blp; - int r = toku_pthread_create(&bl->extractor_thread, NULL, extractor_thread, (void*)bl); - if (r==0) { + int r = toku_pthread_create(*extractor_thread_key, + &bl->extractor_thread, + nullptr, + extractor_thread, + static_cast(bl)); + if (r == 0) { bl->extractor_live = true; - } else { + } else { result = r; (void) toku_ft_loader_internal_destroy(bl, true); } @@ -658,17 +661,17 @@ static void ft_loader_set_panic(FTLOADER bl, int error, bool callback, int which } // One of the tests uses this. -FILE *toku_bl_fidx2file (FTLOADER bl, FIDX i) { +TOKU_FILE *toku_bl_fidx2file(FTLOADER bl, FIDX i) { toku_mutex_lock(&bl->file_infos.lock); - invariant(i.idx >=0 && i.idx < bl->file_infos.n_files); + invariant(i.idx >= 0 && i.idx < bl->file_infos.n_files); invariant(bl->file_infos.file_infos[i.idx].is_open); - FILE *result=bl->file_infos.file_infos[i.idx].file; + TOKU_FILE *result = bl->file_infos.file_infos[i.idx].file; toku_mutex_unlock(&bl->file_infos.lock); return result; } -static int bl_finish_compressed_write(FILE *stream, struct wbuf *wb) { - int r; +static int bl_finish_compressed_write(TOKU_FILE *stream, struct wbuf *wb) { + int r = 0; char *compressed_buf = NULL; const size_t data_size = wb->ndone; invariant(data_size > 0); @@ -719,31 +722,23 @@ static int bl_finish_compressed_write(FILE *stream, struct wbuf *wb) { // Mark as written wb->ndone = 0; - size_t size_to_write = total_size + 4; // Includes writing total_size + size_t size_to_write = total_size + 4; // Includes writing total_size + + r = toku_os_fwrite(compressed_buf, 1, size_to_write, stream); - { - size_t written = do_fwrite(compressed_buf, 1, size_to_write, stream); - if (written!=size_to_write) { - if (os_fwrite_fun) // if using hook to induce artificial errors (for testing) ... - r = get_maybe_error_errno(); // ... then there is no error in the stream, but there is one in errno - else - r = ferror(stream); - invariant(r!=0); - goto exit; - } - } - r = 0; -exit: if (compressed_buf) { toku_free(compressed_buf); } return r; } -static int bl_compressed_write(void *ptr, size_t nbytes, FILE *stream, struct wbuf *wb) { +static int bl_compressed_write(void *ptr, + size_t nbytes, + TOKU_FILE *stream, + struct wbuf *wb) { invariant(wb->size <= MAX_UNCOMPRESSED_BUF); size_t bytes_left = nbytes; - char *buf = (char*)ptr; + char *buf = (char *)ptr; while (bytes_left > 0) { size_t bytes_to_copy = bytes_left; @@ -766,29 +761,28 @@ static int bl_compressed_write(void *ptr, size_t nbytes, FILE *stream, struct wb return 0; } -static int bl_fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream, struct wbuf *wb, FTLOADER bl) -/* Effect: this is a wrapper for fwrite that returns 0 on success, otherwise returns an error number. +static int bl_fwrite(void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + struct wbuf *wb, + FTLOADER bl) +/* Effect: this is a wrapper for fwrite that returns 0 on success, otherwise + * returns an error number. * Arguments: * ptr the data to be writen. * size the amount of data to be written. * nmemb the number of units of size to be written. * stream write the data here. - * wb where to write uncompressed data (if we're compressing) or ignore if NULL - * bl passed so we can panic the ft_loader if something goes wrong (recording the error number). + * wb where to write uncompressed data (if we're compressing) or ignore if + * NULL + * bl passed so we can panic the ft_loader if something goes wrong + * (recording the error number). * Return value: 0 on success, an error number otherwise. */ { if (!bl->compress_intermediates || !wb) { - size_t r = do_fwrite(ptr, size, nmemb, stream); - if (r!=nmemb) { - int e; - if (os_fwrite_fun) // if using hook to induce artificial errors (for testing) ... - e = get_maybe_error_errno(); // ... then there is no error in the stream, but there is one in errno - else - e = ferror(stream); - invariant(e!=0); - return e; - } + return toku_os_fwrite(ptr, size, nmemb, stream); } else { size_t num_bytes = size * nmemb; int r = bl_compressed_write(ptr, num_bytes, stream, wb); @@ -799,8 +793,9 @@ static int bl_fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream, struct return 0; } -static int bl_fread (void *ptr, size_t size, size_t nmemb, FILE *stream) -/* Effect: this is a wrapper for fread that returns 0 on success, otherwise returns an error number. +static int bl_fread(void *ptr, size_t size, size_t nmemb, TOKU_FILE *stream) +/* Effect: this is a wrapper for fread that returns 0 on success, otherwise + * returns an error number. * Arguments: * ptr read data into here. * size size of data element to be read. @@ -809,24 +804,14 @@ static int bl_fread (void *ptr, size_t size, size_t nmemb, FILE *stream) * Return value: 0 on success, an error number otherwise. */ { - size_t r = fread(ptr, size, nmemb, stream); - if (r==0) { - if (feof(stream)) return EOF; - else { - do_error: ; - int e = ferror(stream); - // r == 0 && !feof && e == 0, how does this happen? invariant(e!=0); - return e; - } - } else if (rsize; if ((r=bl_fwrite(&dlen, sizeof(dlen), 1, datafile, wb, bl))) return r; @@ -836,8 +821,7 @@ static int bl_write_dbt (DBT *dbt, FILE* datafile, uint64_t *dataoff, struct wbu return 0; } -static int bl_read_dbt (/*in*/DBT *dbt, FILE *stream) -{ +static int bl_read_dbt(/*in*/ DBT *dbt, TOKU_FILE *stream) { int len; { int r; @@ -891,13 +875,20 @@ static int bl_read_dbt_from_dbufio (/*in*/DBT *dbt, DBUFIO_FILESET bfs, int file return result; } - -int loader_write_row(DBT *key, DBT *val, FIDX data, FILE *dataf, uint64_t *dataoff, struct wbuf *wb, FTLOADER bl) -/* Effect: Given a key and a val (both DBTs), write them to a file. Increment *dataoff so that it's up to date. +int loader_write_row(DBT *key, + DBT *val, + FIDX data, + TOKU_FILE *dataf, + uint64_t *dataoff, + struct wbuf *wb, + FTLOADER bl) +/* Effect: Given a key and a val (both DBTs), write them to a file. Increment + * *dataoff so that it's up to date. * Arguments: * key, val write these. * data the file to write them to - * dataoff a pointer to a counter that keeps track of the amount of data written so far. + * dataoff a pointer to a counter that keeps track of the amount of data + * written so far. * wb a pointer (possibly NULL) to buffer uncompressed output * bl the ft_loader (passed so we can panic if needed). * Return value: 0 on success, an error number otherwise. @@ -915,8 +906,9 @@ int loader_write_row(DBT *key, DBT *val, FIDX data, FILE *dataf, uint64_t *datao return 0; } -int loader_read_row (FILE *f, DBT *key, DBT *val) -/* Effect: Read a key value pair from a file. The DBTs must have DB_DBT_REALLOC set. +int loader_read_row(TOKU_FILE *f, DBT *key, DBT *val) +/* Effect: Read a key value pair from a file. The DBTs must have DB_DBT_REALLOC + * set. * Arguments: * f where to read it from. * key, val read it into these. @@ -1086,7 +1078,7 @@ static void* extractor_thread (void *blv) { FTLOADER bl = (FTLOADER)blv; int r = 0; while (1) { - void *item; + void *item = nullptr; { int rq = toku_queue_deq(bl->primary_rowset_queue, &item, NULL, NULL); if (rq==EOF) break; @@ -1107,14 +1099,14 @@ static void* extractor_thread (void *blv) { //printf("%s:%d extractor finishing\n", __FILE__, __LINE__); if (r == 0) { r = finish_primary_rows(bl); - if (r) + if (r) ft_loader_set_panic(bl, r, false, 0, nullptr, nullptr); - } - return NULL; + toku_instr_delete_current_thread(); + return nullptr; } -static void enqueue_for_extraction (FTLOADER bl) { +static void enqueue_for_extraction(FTLOADER bl) { //printf("%s:%d enqueing %ld items\n", __FILE__, __LINE__, bl->primary_rowset.n_rows); struct rowset *XMALLOC(enqueue_me); *enqueue_me = bl->primary_rowset; @@ -1625,11 +1617,12 @@ static int write_rowset_to_file (FTLOADER bl, FIDX sfile, const struct rowset ro struct wbuf wb; wbuf_init(&wb, uncompressed_buffer, MAX_UNCOMPRESSED_BUF); - FILE *sstream = toku_bl_fidx2file(bl, sfile); - for (size_t i=0; iprogress, bl->progress+progress_allocation); + // printf(" merge_some_files progress=%d fin at %d\n", bl->progress, + // bl->progress+progress_allocation); DBT keys[n_sources]; DBT vals[n_sources]; uint64_t dataoff[n_sources]; @@ -1942,12 +1952,18 @@ static int merge_some_files (const bool to_q, FIDX dest_data, QUEUE q, int n_sou int result = 0; DBUFIO_FILESET bfs = NULL; int *MALLOC_N(n_sources, fds); - if (fds==NULL) result=get_error_errno(); - if (result==0) { - for (int i=0; ifile); // we rely on the + // fact that when + // the files are + // closed, the fd + // is also closed. + if (r == -1) { + result = get_error_errno(); break; } fds[i] = r; @@ -2177,7 +2193,7 @@ static inline void dbout_init(struct dbout *out, FT ft) { out->current_off = 0; out->n_translations = out->n_translations_limit = 0; out->translation = NULL; - toku_mutex_init(&out->mutex, NULL); + toku_mutex_init(*loader_out_mutex_key, &out->mutex, nullptr); out->ft = ft; } @@ -2417,7 +2433,7 @@ static int toku_loader_write_ft_from_q (FTLOADER bl, assert_zero(r); return result; } - FILE *pivots_stream = toku_bl_fidx2file(bl, pivots_file); + TOKU_FILE *pivots_stream = toku_bl_fidx2file(bl, pivots_file); TXNID root_xid_that_created = TXNID_NONE; if (bl->root_xids_that_created) @@ -2704,21 +2720,35 @@ int toku_loader_write_ft_from_q_in_C (FTLOADER bl, static void* fractal_thread (void *ftav) { struct fractal_thread_args *fta = (struct fractal_thread_args *)ftav; - int r = toku_loader_write_ft_from_q (fta->bl, fta->descriptor, fta->fd, fta->progress_allocation, fta->q, fta->total_disksize_estimate, fta->which_db, fta->target_nodesize, fta->target_basementnodesize, fta->target_compression_method, fta->target_fanout); + int r = toku_loader_write_ft_from_q(fta->bl, + fta->descriptor, + fta->fd, + fta->progress_allocation, + fta->q, + fta->total_disksize_estimate, + fta->which_db, + fta->target_nodesize, + fta->target_basementnodesize, + fta->target_compression_method, + fta->target_fanout); fta->errno_result = r; - return NULL; -} - -static int loader_do_i (FTLOADER bl, - int which_db, - DB *dest_db, - ft_compare_func compare, - const DESCRIPTOR descriptor, - const char *new_fname, - int progress_allocation // how much progress do I need to add into bl->progress by the end.. - ) + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); +} + +static int loader_do_i(FTLOADER bl, + int which_db, + DB *dest_db, + ft_compare_func compare, + const DESCRIPTOR descriptor, + const char *new_fname, + int progress_allocation // how much progress do I need + // to add into bl->progress by + // the end.. + ) /* Effect: Handle the file creating for one particular DB in the bulk loader. */ -/* Requires: The data is fully extracted, so we can do merges out of files and write the ft file. */ +/* Requires: The data is fully extracted, so we can do merges out of files and + write the ft file. */ { //printf("doing i use %d progress=%d fin at %d\n", progress_allocation, bl->progress, bl->progress+progress_allocation); struct merge_fileset *fs = &(bl->fs[which_db]); @@ -2729,10 +2759,14 @@ static int loader_do_i (FTLOADER bl, if (r) goto error; { - mode_t mode = S_IRUSR+S_IWUSR + S_IRGRP+S_IWGRP; - int fd = toku_os_open(new_fname, O_RDWR| O_CREAT | O_BINARY, mode); // #2621 + mode_t mode = S_IRUSR + S_IWUSR + S_IRGRP + S_IWGRP; + int fd = toku_os_open(new_fname, + O_RDWR | O_CREAT | O_BINARY, + mode, + *tokudb_file_load_key); // #2621 if (fd < 0) { - r = get_error_errno(); goto error; + r = get_error_errno(); + goto error; } uint32_t target_nodesize, target_basementnodesize, target_fanout; @@ -2752,24 +2786,27 @@ static int loader_do_i (FTLOADER bl, progress_allocation -= allocation_for_merge; // This structure must stay live until the join below. - struct fractal_thread_args fta = { - bl, - descriptor, - fd, - progress_allocation, - bl->fractal_queues[which_db], - bl->extracted_datasizes[which_db], - 0, - which_db, - target_nodesize, - target_basementnodesize, - target_compression_method, - target_fanout - }; - - r = toku_pthread_create(bl->fractal_threads+which_db, NULL, fractal_thread, (void*)&fta); + struct fractal_thread_args fta = {bl, + descriptor, + fd, + progress_allocation, + bl->fractal_queues[which_db], + bl->extracted_datasizes[which_db], + 0, + which_db, + target_nodesize, + target_basementnodesize, + target_compression_method, + target_fanout}; + + r = toku_pthread_create(*fractal_thread_key, + bl->fractal_threads + which_db, + nullptr, + fractal_thread, + static_cast(&fta)); if (r) { - int r2 __attribute__((__unused__)) = toku_queue_destroy(bl->fractal_queues[which_db]); + int r2 __attribute__((__unused__)) = + toku_queue_destroy(bl->fractal_queues[which_db]); // ignore r2, since we already have an error bl->fractal_queues[which_db] = nullptr; goto error; @@ -3106,7 +3143,7 @@ static int read_some_pivots (FIDX pivots_file, int n_to_read, FTLOADER bl, for (int i = 0; i < n_to_read; i++) pivots[i] = zero_dbt; - FILE *pivots_stream = toku_bl_fidx2file(bl, pivots_file); + TOKU_FILE *pivots_stream = toku_bl_fidx2file(bl, pivots_file); int result = 0; for (int i = 0; i < n_to_read; i++) { @@ -3158,8 +3195,9 @@ static int setup_nonleaf_block (int n_children, } if (result == 0) { - FILE *next_pivots_stream = toku_bl_fidx2file(bl, next_pivots_file); - int r = bl_write_dbt(&pivots[n_children-1], next_pivots_stream, NULL, nullptr, bl); + TOKU_FILE *next_pivots_stream = toku_bl_fidx2file(bl, next_pivots_file); + int r = bl_write_dbt( + &pivots[n_children - 1], next_pivots_stream, NULL, nullptr, bl); if (r) result = r; } @@ -3274,8 +3312,11 @@ static int write_nonleaves (FTLOADER bl, FIDX pivots_fidx, struct dbout *out, st // 2) We put the 15 pivots and 16 blocks into an non-leaf node. // 3) We put the 16th pivot into the next pivots file. { - int r = fseek(toku_bl_fidx2file(bl, pivots_fidx), 0, SEEK_SET); - if (r!=0) { return get_error_errno(); } + int r = + fseek(toku_bl_fidx2file(bl, pivots_fidx)->file, 0, SEEK_SET); + if (r != 0) { + return get_error_errno(); + } } FIDX next_pivots_file; @@ -3295,7 +3336,7 @@ static int write_nonleaves (FTLOADER bl, FIDX pivots_fidx, struct dbout *out, st while (sts->n_subtrees - n_subtrees_used >= n_per_block*2) { // grab the first N_PER_BLOCK and build a node. DBT *pivots; - int64_t blocknum_of_new_node; + int64_t blocknum_of_new_node = 0; struct subtree_info *subtree_info; int r = setup_nonleaf_block (n_per_block, sts, pivots_fidx, n_subtrees_used, diff --git a/storage/tokudb/PerconaFT/ft/loader/loader.h b/storage/tokudb/PerconaFT/ft/loader/loader.h index 9c1bdab1ee2821403e7f2cf1453982e5af83ef8c..cea2e8dfda26d85111ba1db8dbac5debc5437231 100644 --- a/storage/tokudb/PerconaFT/ft/loader/loader.h +++ b/storage/tokudb/PerconaFT/ft/loader/loader.h @@ -38,6 +38,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #pragma once +#include "toku_portability.h" #include "ft/txn/txn.h" #include "ft/cachetable/cachetable.h" #include "ft/comparator.h" @@ -77,8 +78,6 @@ int toku_ft_loader_abort(FTLOADER bl, bool is_error); // For test purposes only -void toku_ft_loader_set_size_factor (uint32_t factor); - -void ft_loader_set_os_fwrite (size_t (*fwrite_fun)(const void*,size_t,size_t,FILE*)); +void toku_ft_loader_set_size_factor(uint32_t factor); size_t ft_loader_leafentry_size(size_t key_size, size_t val_size, TXNID xid); diff --git a/storage/tokudb/PerconaFT/ft/logger/log-internal.h b/storage/tokudb/PerconaFT/ft/logger/log-internal.h index bee74fac346af3b762d40e19512fbbdfad2126a8..be19e1342cdf8269e4042aa8da80d2461624649d 100644 --- a/storage/tokudb/PerconaFT/ft/logger/log-internal.h +++ b/storage/tokudb/PerconaFT/ft/logger/log-internal.h @@ -70,11 +70,11 @@ struct mylock { }; static inline void ml_init(struct mylock *l) { - toku_mutex_init(&l->lock, 0); -} -static inline void ml_lock(struct mylock *l) { - toku_mutex_lock(&l->lock); + toku_mutex_init(*log_internal_lock_mutex_key, &l->lock, nullptr); } +// TODO: source location info might have be to be pulled up one caller +// to be useful +static inline void ml_lock(struct mylock *l) { toku_mutex_lock(&l->lock); } static inline void ml_unlock(struct mylock *l) { toku_mutex_unlock(&l->lock); } diff --git a/storage/tokudb/PerconaFT/ft/logger/logcursor.cc b/storage/tokudb/PerconaFT/ft/logger/logcursor.cc index f13419ae43e17bb74c2fa0beddb0becb0a160ea2..494d3b1d53144a046726a625a16d677f5c8a8d2d 100644 --- a/storage/tokudb/PerconaFT/ft/logger/logcursor.cc +++ b/storage/tokudb/PerconaFT/ft/logger/logcursor.cc @@ -85,10 +85,10 @@ static int lc_close_cur_logfile(TOKULOGCURSOR lc) { } static toku_off_t lc_file_len(const char *name) { - toku_struct_stat buf; - int r = toku_stat(name, &buf); - assert(r == 0); - return buf.st_size; + toku_struct_stat buf; + int r = toku_stat(name, &buf, *tokudb_file_data_key); + assert(r == 0); + return buf.st_size; } // Cat the file and throw away the contents. This brings the file into the file system cache diff --git a/storage/tokudb/PerconaFT/ft/logger/logger.cc b/storage/tokudb/PerconaFT/ft/logger/logger.cc index eacec9cb83f7bb21865083f24802d222c7a22f15..3f13fe10febb7cf4149fa9a2732bb001808e9902 100644 --- a/storage/tokudb/PerconaFT/ft/logger/logger.cc +++ b/storage/tokudb/PerconaFT/ft/logger/logger.cc @@ -49,11 +49,17 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/status.h" -static const int log_format_version=TOKU_LOG_VERSION; +static const int log_format_version = TOKU_LOG_VERSION; -static int open_logfile (TOKULOGGER logger); -static void logger_write_buffer (TOKULOGGER logger, LSN *fsynced_lsn); -static void delete_logfile(TOKULOGGER logger, long long index, uint32_t version); +toku_instr_key *result_output_condition_lock_mutex_key; +toku_instr_key *result_output_condition_key; +toku_instr_key *tokudb_file_log_key; + +static int open_logfile(TOKULOGGER logger); +static void logger_write_buffer(TOKULOGGER logger, LSN *fsynced_lsn); +static void delete_logfile(TOKULOGGER logger, + long long index, + uint32_t version); static void grab_output(TOKULOGGER logger, LSN *fsynced_lsn); static void release_output(TOKULOGGER logger, LSN fsynced_lsn); @@ -131,10 +137,13 @@ int toku_logger_create (TOKULOGGER *resultp) { // n_in_file is uninitialized result->write_block_size = FT_DEFAULT_NODE_SIZE; // default logging size is the same as the default ft block size toku_logfilemgr_create(&result->logfilemgr); - *resultp=result; + *resultp = result; ml_init(&result->input_lock); - toku_mutex_init(&result->output_condition_lock, NULL); - toku_cond_init(&result->output_condition, NULL); + toku_mutex_init(*result_output_condition_lock_mutex_key, + &result->output_condition_lock, + nullptr); + toku_cond_init( + *result_output_condition_key, &result->output_condition, nullptr); result->rollback_cachefile = NULL; result->output_is_available = true; toku_txn_manager_init(&result->txn_manager); @@ -300,10 +309,10 @@ int toku_logger_close(TOKULOGGER *loggerp) { grab_output(logger, &fsynced_lsn); logger_write_buffer(logger, &fsynced_lsn); if (logger->fd!=-1) { - if ( logger->write_log_files ) { + if (logger->write_log_files) { toku_file_fsync_without_accounting(logger->fd); } - r = close(logger->fd); + r = toku_os_close(logger->fd); assert(r == 0); } r = close_logdir(logger); @@ -345,9 +354,13 @@ static int close_and_open_logfile (TOKULOGGER logger, LSN *fsynced_lsn) if (logger->write_log_files) { toku_file_fsync_without_accounting(logger->fd); *fsynced_lsn = logger->written_lsn; - toku_logfilemgr_update_last_lsn(logger->logfilemgr, logger->written_lsn); // fixes t:2294 + toku_logfilemgr_update_last_lsn(logger->logfilemgr, + logger->written_lsn); // fixes t:2294 } - r = close(logger->fd); if (r!=0) return get_error_errno(); + r = toku_os_close(logger->fd); + + if (r != 0) + return get_error_errno(); return open_logfile(logger); } @@ -677,18 +690,28 @@ static int open_logfile (TOKULOGGER logger) { int fnamelen = strlen(logger->directory)+50; char fname[fnamelen]; - snprintf(fname, fnamelen, "%s/log%012lld.tokulog%d", logger->directory, logger->next_log_file_number, TOKU_LOG_VERSION); + snprintf(fname, + fnamelen, + "%s/log%012lld.tokulog%d", + logger->directory, + logger->next_log_file_number, + TOKU_LOG_VERSION); long long index = logger->next_log_file_number; if (logger->write_log_files) { - logger->fd = open(fname, O_CREAT+O_WRONLY+O_TRUNC+O_EXCL+O_BINARY, S_IRUSR+S_IWUSR); - if (logger->fd==-1) { + logger->fd = + toku_os_open(fname, + O_CREAT + O_WRONLY + O_TRUNC + O_EXCL + O_BINARY, + S_IRUSR + S_IWUSR, + *tokudb_file_log_key); + if (logger->fd == -1) { return get_error_errno(); } fsync_logdir(logger); logger->next_log_file_number++; } else { - logger->fd = open(DEV_NULL_FILE, O_WRONLY+O_BINARY); - if (logger->fd==-1) { + logger->fd = toku_os_open( + DEV_NULL_FILE, O_WRONLY + O_BINARY, S_IWUSR, *tokudb_file_log_key); + if (logger->fd == -1) { return get_error_errno(); } } @@ -834,10 +857,11 @@ int toku_logger_restart(TOKULOGGER logger, LSN lastlsn) logger_write_buffer(logger, &fsynced_lsn); // close the log file - if ( logger->write_log_files) { // fsyncs don't work to /dev/null + if (logger->write_log_files) { // fsyncs don't work to /dev/null toku_file_fsync_without_accounting(logger->fd); } - r = close(logger->fd); assert(r == 0); + r = toku_os_close(logger->fd); + assert(r == 0); logger->fd = -1; // reset the LSN's to the lastlsn when the logger was opened @@ -1237,11 +1261,13 @@ void toku_txnid2txn(TOKULOGGER logger, TXNID_PAIR txnid, TOKUTXN *result) { } // Find the earliest LSN in a log. No locks are needed. -static int peek_at_log (TOKULOGGER logger, char* filename, LSN *first_lsn) { - int fd = open(filename, O_RDONLY+O_BINARY); - if (fd<0) { +static int peek_at_log(TOKULOGGER logger, char *filename, LSN *first_lsn) { + int fd = toku_os_open( + filename, O_RDONLY + O_BINARY, S_IRUSR, *tokudb_file_log_key); + if (fd < 0) { int er = get_error_errno(); - if (logger->write_log_files) printf("couldn't open: %s\n", strerror(er)); + if (logger->write_log_files) + printf("couldn't open: %s\n", strerror(er)); return er; } enum { SKIP = 12+1+4 }; // read the 12 byte header, the first message, and the first len @@ -1258,10 +1284,13 @@ static int peek_at_log (TOKULOGGER logger, char* filename, LSN *first_lsn) { lsn = rbuf_ulonglong(&rb); } - r=close(fd); - if (r!=0) { return 0; } + r = toku_os_close(fd); + + if (r != 0) { + return 0; + } - first_lsn->lsn=lsn; + first_lsn->lsn = lsn; return 0; } diff --git a/storage/tokudb/PerconaFT/ft/logger/recover.cc b/storage/tokudb/PerconaFT/ft/logger/recover.cc index 9eaa56bdc539478a94ea274eb89d45b9df884954..9a9a1214ecbf67e69610271fc9f5de054cbff3ee 100644 --- a/storage/tokudb/PerconaFT/ft/logger/recover.cc +++ b/storage/tokudb/PerconaFT/ft/logger/recover.cc @@ -954,14 +954,14 @@ static int toku_recover_frename(struct logtype_frename *l, RECOVER_ENV renv) { std::unique_ptr new_iname_full( toku_construct_full_name(2, data_dir, l->new_iname.data), &toku_free); - if (toku_stat(old_iname_full.get(), &stat) == -1) { + if (toku_stat(old_iname_full.get(), &stat, toku_uninstrumented) == -1) { if (ENOENT == errno) old_exist = false; else return 1; } - if (toku_stat(new_iname_full.get(), &stat) == -1) { + if (toku_stat(new_iname_full.get(), &stat, toku_uninstrumented) == -1) { if (ENOENT == errno) new_exist = false; else @@ -980,7 +980,7 @@ static int toku_recover_frename(struct logtype_frename *l, RECOVER_ENV renv) { // 'stalled cachefiles' container the new file is removed // and the old file is renamed. if (old_exist && new_exist && - (toku_os_unlink(new_iname_full.get()) == -1 || + (toku_os_delete(new_iname_full.get()) == -1 || toku_os_rename(old_iname_full.get(), new_iname_full.get()) == -1 || toku_fsync_directory(old_iname_full.get()) == -1 || toku_fsync_directory(new_iname_full.get()) == -1)) @@ -1473,9 +1473,13 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di { toku_struct_stat buf; - if (toku_stat(env_dir, &buf)!=0) { + if (toku_stat(env_dir, &buf, toku_uninstrumented)) { rr = get_error_errno(); - fprintf(stderr, "%.24s PerconaFT recovery error: directory does not exist: %s\n", ctime(&tnow), env_dir); + fprintf(stderr, + "%.24s PerconaFT recovery error: directory does not exist: " + "%s\n", + ctime(&tnow), + env_dir); goto errorexit; } else if (!S_ISDIR(buf.st_mode)) { fprintf(stderr, "%.24s PerconaFT recovery error: this file is supposed to be a directory, but is not: %s\n", ctime(&tnow), env_dir); diff --git a/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc b/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc index 19811373d16367e44e9975beebd9d557cab8457f..29f6daa293ae1483beac50bdc5ff7a684454e497 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc +++ b/storage/tokudb/PerconaFT/ft/serialize/block_allocator.cc @@ -40,6 +40,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include +#include "toku_portability.h" #include "portability/memory.h" #include "portability/toku_assert.h" #include "portability/toku_stdint.h" diff --git a/storage/tokudb/PerconaFT/ft/serialize/block_table.cc b/storage/tokudb/PerconaFT/ft/serialize/block_table.cc index d2532134d96cff9dc9011de5c62945ca34448d0b..56d51f56915236f863b00578b3cfe88769d0370d 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/block_table.cc +++ b/storage/tokudb/PerconaFT/ft/serialize/block_table.cc @@ -54,6 +54,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/nb_mutex.h" #include "util/scoped_malloc.h" + +toku_instr_key *block_table_mutex_key; +toku_instr_key *safe_file_size_lock_mutex_key; +toku_instr_key *safe_file_size_lock_rwlock_key; + // indicates the end of a freelist static const BLOCKNUM freelist_null = {-1}; @@ -99,8 +104,10 @@ void block_table::_create_internal() { memset(&_checkpointed, 0, sizeof(struct translation)); memset(&_mutex, 0, sizeof(_mutex)); _bt_block_allocator = new BlockAllocator(); - toku_mutex_init(&_mutex, nullptr); - nb_mutex_init(&_safe_file_size_lock); + toku_mutex_init(*block_table_mutex_key, &_mutex, nullptr); + nb_mutex_init(*safe_file_size_lock_mutex_key, + *safe_file_size_lock_rwlock_key, + &_safe_file_size_lock); } // Fill in the checkpointed translation from buffer, and copy checkpointed to @@ -128,7 +135,7 @@ int block_table::create_from_buffer( _copy_translation(&_current, &_checkpointed, TRANSLATION_CURRENT); // Determine the file size - int64_t file_size; + int64_t file_size = 0; r = toku_os_get_file_size(fd, &file_size); lazy_assert_zero(r); invariant(file_size >= 0); diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc index fcab9fc675e5902ae699be1f926dea936f18372d..b24d72a5dff5b46e7eb5f27ea14cf39bed64891d 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc +++ b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc @@ -417,8 +417,10 @@ static size_t serialize_ft_min_size(uint32_t version) { switch (version) { case FT_LAYOUT_VERSION_29: size += sizeof(uint64_t); // logrows in ft + // fallthrough case FT_LAYOUT_VERSION_28: size += sizeof(uint32_t); // fanout in ft + // fallthrough case FT_LAYOUT_VERSION_27: case FT_LAYOUT_VERSION_26: case FT_LAYOUT_VERSION_25: @@ -427,10 +429,12 @@ static size_t serialize_ft_min_size(uint32_t version) { case FT_LAYOUT_VERSION_22: case FT_LAYOUT_VERSION_21: size += sizeof(MSN); // max_msn_in_ft + // fallthrough case FT_LAYOUT_VERSION_20: case FT_LAYOUT_VERSION_19: size += 1; // compression method size += sizeof(MSN); // highest_unused_msn_for_upgrade + // fallthrough case FT_LAYOUT_VERSION_18: size += sizeof(uint64_t); // time_of_last_optimize_begin size += sizeof(uint64_t); // time_of_last_optimize_end @@ -438,9 +442,11 @@ static size_t serialize_ft_min_size(uint32_t version) { size += sizeof(MSN); // msn_at_start_of_last_completed_optimize size -= 8; // removed num_blocks_to_upgrade_14 size -= 8; // removed num_blocks_to_upgrade_13 + // fallthrough case FT_LAYOUT_VERSION_17: size += 16; invariant(sizeof(STAT64INFO_S) == 16); + // fallthrough case FT_LAYOUT_VERSION_16: case FT_LAYOUT_VERSION_15: size += 4; // basement node size @@ -448,8 +454,10 @@ static size_t serialize_ft_min_size(uint32_t version) { // num_blocks_to_upgrade, now one int each for upgrade // from 13, 14 size += 8; // time of last verification + // fallthrough case FT_LAYOUT_VERSION_14: size += 8; // TXNID that created + // fallthrough case FT_LAYOUT_VERSION_13: size += (4 // build_id + @@ -459,7 +467,7 @@ static size_t serialize_ft_min_size(uint32_t version) { + 8 // time_of_last_modification ); - // fall through + // fallthrough case FT_LAYOUT_VERSION_12: size += (+8 // "tokudata" + diff --git a/storage/tokudb/PerconaFT/ft/serialize/sub_block.cc b/storage/tokudb/PerconaFT/ft/serialize/sub_block.cc index c967d4b4c1cf59de456f3d9b767c3b39d9e76b5c..6dc1f82844ac30ae29c92966c67da9da1e2002a5 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/sub_block.cc +++ b/storage/tokudb/PerconaFT/ft/serialize/sub_block.cc @@ -51,6 +51,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "util/threadpool.h" #include "util/x1764.h" +toku_instr_key *workset_lock_mutex_key; +toku_instr_key *ws_worker_wait_key; + SUB_BLOCK sub_block_creat(void) { SUB_BLOCK XMALLOC(sb); sub_block_init(sb); diff --git a/storage/tokudb/PerconaFT/ft/serialize/workset.h b/storage/tokudb/PerconaFT/ft/serialize/workset.h index 073741fccb120228a380cf671479026a0288ab8b..295eb73cec9f00c62800e1d5ad212777a1fc49d5 100644 --- a/storage/tokudb/PerconaFT/ft/serialize/workset.h +++ b/storage/tokudb/PerconaFT/ft/serialize/workset.h @@ -41,6 +41,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include #include +extern toku_instr_key *ws_worker_wait_key; + // The work struct is the base class for work to be done by some threads struct work { struct toku_list next; @@ -54,16 +56,14 @@ struct workset { toku_cond_t worker_wait; // a condition variable used to wait for all of the worker to release their reference on the workset }; -static inline void -workset_init(struct workset *ws) { - toku_mutex_init(&ws->lock, NULL); +static inline void workset_init(struct workset *ws) { + toku_mutex_init(*workset_lock_mutex_key, &ws->lock, nullptr); toku_list_init(&ws->worklist); - ws->refs = 1; // the calling thread gets a reference - toku_cond_init(&ws->worker_wait, NULL); + ws->refs = 1; // the calling thread gets a reference + toku_cond_init(*ws_worker_wait_key, &ws->worker_wait, nullptr); } -static inline void -workset_destroy(struct workset *ws) { +static inline void workset_destroy(struct workset *ws) { invariant(toku_list_empty(&ws->worklist)); toku_cond_destroy(&ws->worker_wait); toku_mutex_destroy(&ws->lock); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc index 8bbda2954627c4300a9f2309ef15af3ba41bb5a2..0af5c8185a965c7b600b67a311c6b1ff0e77dd51 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-4357.cc @@ -71,21 +71,26 @@ cachetable_test (void) { void* v1; long s1; - r = toku_cachetable_get_and_pin( - f1, - make_blocknum(1), - toku_cachetable_hash(f1, make_blocknum(1)), - &v1, - &s1, - def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, - true, - NULL - ); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + toku_cachetable_hash(f1, make_blocknum(1)), + &v1, + &s1, + def_write_callback(NULL), + def_fetch, + def_pf_req_callback, + def_pf_callback, + true, + NULL); toku_pthread_t pin_nonblocking_tid; - r = toku_pthread_create(&pin_nonblocking_tid, NULL, pin_nonblocking, NULL); - assert_zero(r); + r = toku_pthread_create(toku_uninstrumented, + &pin_nonblocking_tid, + nullptr, + pin_nonblocking, + nullptr); + assert_zero(r); // sleep 3 seconds - usleep(3*1024*1024); + usleep(3 * 1024 * 1024); r = toku_test_cachetable_unpin_and_remove(f1, make_blocknum(1), NULL, NULL); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc index 9c54c086f5b451be91ea9c6f6504e176f3f03653..7bee0b807702175da724041da4edeccd9aff9ea1 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-4365.cc @@ -71,15 +71,16 @@ static void *put_same_key(void *arg) { return arg; } - toku_pthread_t put_tid; -static void test_remove_key(CACHEKEY* UU(cachekey), bool UU(for_checkpoint), void* UU(extra)) { - int r = toku_pthread_create(&put_tid, NULL, put_same_key, NULL); - assert_zero(r); +static void test_remove_key(CACHEKEY *UU(cachekey), + bool UU(for_checkpoint), + void *UU(extra)) { + int r = toku_pthread_create( + toku_uninstrumented, &put_tid, nullptr, put_same_key, nullptr); + assert_zero(r); } - static void cachetable_test (void) { const int test_limit = 12; @@ -92,21 +93,26 @@ cachetable_test (void) { void* v1; long s1; - r = toku_cachetable_get_and_pin( - f1, - make_blocknum(1), - toku_cachetable_hash(f1, make_blocknum(1)), - &v1, - &s1, - def_write_callback(NULL), def_fetch, def_pf_req_callback, def_pf_callback, - true, - NULL - ); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + toku_cachetable_hash(f1, make_blocknum(1)), + &v1, + &s1, + def_write_callback(nullptr), + def_fetch, + def_pf_req_callback, + def_pf_callback, + true, + nullptr); toku_pthread_t pin_nonblocking_tid; - r = toku_pthread_create(&pin_nonblocking_tid, NULL, pin_nonblocking, NULL); - assert_zero(r); + r = toku_pthread_create(toku_uninstrumented, + &pin_nonblocking_tid, + nullptr, + pin_nonblocking, + nullptr); + assert_zero(r); // sleep 3 seconds - usleep(3*1024*1024); + usleep(3 * 1024 * 1024); r = toku_test_cachetable_unpin_and_remove(f1, make_blocknum(1), test_remove_key, NULL); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc index c1b6e0a94f24eebb24a1ca96d86bd9bcd517d311..5ab0df88e0873ae43a704cc38b647acd0d022626 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-5097.cc @@ -153,13 +153,16 @@ cachetable_test (void) { assert(r == 0); } - // at this point, we have a dirty PAIR in the cachetable associated with cachefile f1 - // launch a thread that will put another PAIR in the cachetable, and get partial eviction started + // at this point, we have a dirty PAIR in the cachetable associated with + // cachefile f1 + // launch a thread that will put another PAIR in the cachetable, and get + // partial eviction started toku_pthread_t tid; - r = toku_pthread_create(&tid, NULL, f2_pin, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, f2_pin, nullptr); assert_zero(r); - usleep(2*1024*1024); + usleep(2 * 1024 * 1024); check_flush = true; toku_cachefile_close(&f1, false, ZERO_LSN); if (enable_partial_eviction) diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc index b462d76eeee1d47ef70f2e169d206e43c80c9df6..0b5110ddd993fc7f214401115bc7e296fe3d5138 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978-2.cc @@ -114,14 +114,14 @@ unpin_two (void* UU(v)) { ); assert_zero(r); - // at this point, we have p1 pinned, want to start a thread to do an unpin_and_remove - // on p1 - r = toku_pthread_create( - &unpin_and_remove_tid, - NULL, - unpin_and_remove_one, - NULL - ); + // at this point, we have p1 pinned, want to start a thread to do an + // unpin_and_remove + // on p1 + r = toku_pthread_create(toku_uninstrumented, + &unpin_and_remove_tid, + nullptr, + unpin_and_remove_one, + nullptr); assert_zero(r); // sleep to give a chance for the unpin_and_remove to get going usleep(512*1024); @@ -173,9 +173,9 @@ cachetable_test (void) { r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v1, &s1, wc, fetch_two, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); - toku_pthread_t tid1; - r = toku_pthread_create(&tid1, NULL, repin_one, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid1, nullptr, repin_one, nullptr); assert_zero(r); void *ret; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc index ee68ab3ef0bb9197156a172c946deafa69119419..a4ff6c33e6acf7ecc219a632ebd648bf04e20690 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-5978.cc @@ -199,9 +199,11 @@ cachetable_test (void) { toku_pthread_t tid1; toku_pthread_t tid2; - r = toku_pthread_create(&tid1, NULL, repin_one, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid1, nullptr, repin_one, nullptr); assert_zero(r); - r = toku_pthread_create(&tid2, NULL, repin_two, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid2, nullptr, repin_two, nullptr); assert_zero(r); // unpin 1 and 2 so tid1 and tid2 can make progress diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc index 3dd3a15e2de35173ac58aa6130ee1ac1fd9245c1..5e87fed740d63f94f11c59fe8bf157ea40a0b4a2 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-checkpoint-pending.cc @@ -158,14 +158,24 @@ static void checkpoint_pending(void) { // the checkpoint should cause n writes, but since n <= the cachetable size, // all items should be kept in the cachetable - n_flush = n_write_me = n_keep_me = n_fetch = 0; expect_value = 42; - //printf("E42\n"); + n_flush = n_write_me = n_keep_me = n_fetch = 0; + expect_value = 42; + // printf("E42\n"); toku_pthread_t checkpoint_thread, update_thread; - r = toku_pthread_create(&checkpoint_thread, NULL, do_checkpoint, NULL); assert(r==0); - r = toku_pthread_create(&update_thread, NULL, do_update, NULL); assert(r==0); - r = toku_pthread_join(checkpoint_thread, 0); assert(r==0); - r = toku_pthread_join(update_thread, 0); assert(r==0); - + r = toku_pthread_create(toku_uninstrumented, + &checkpoint_thread, + nullptr, + do_checkpoint, + nullptr); + assert(r == 0); + r = toku_pthread_create( + toku_uninstrumented, &update_thread, nullptr, do_update, nullptr); + assert(r == 0); + r = toku_pthread_join(checkpoint_thread, 0); + assert(r == 0); + r = toku_pthread_join(update_thread, 0); + assert(r == 0); + assert(n_flush == N && n_write_me == N && n_keep_me == N); // after the checkpoint, all of the items should be 43 diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc index c1e7b373e837ceee55cab3c353ff9a4b6d797338..dd6c674af24e72bd94875feddddbad5f99fc013e 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-cleaner-thread-attrs-accumulate.cc @@ -91,7 +91,7 @@ run_test (void) { const int test_limit = 1000; int r; CACHETABLE ct; - toku_mutex_init(&attr_mutex, NULL); + toku_mutex_init(toku_uninstrumented, &attr_mutex, nullptr); toku_cachetable_create(&ct, test_limit, ZERO_LSN, nullptr); const char *fname1 = TOKU_TEST_FILENAME; diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc index 50bd20f492e090c88cda97b7f819fb9498b19d90..99d595b1ff17eadbf89baa20bc23334e64d0c9f5 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-clone-checkpoint.cc @@ -112,14 +112,17 @@ cachetable_test (void) { CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); - clone_flush_started = false; clone_flush_completed = false; toku_pthread_t checkpoint_tid; - r = toku_pthread_create(&checkpoint_tid, NULL, run_end_checkpoint, NULL); - assert_zero(r); + r = toku_pthread_create(toku_uninstrumented, + &checkpoint_tid, + nullptr, + run_end_checkpoint, + nullptr); + assert_zero(r); - usleep(1*1024*1024); + usleep(1 * 1024 * 1024); r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc index 8a270af0566cc34d65a010b31d74690e4e131d1c..65b02aebaec135d39ae3e592e5ae1ae4fee71202 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-pin-checkpoint.cc @@ -386,19 +386,28 @@ cachetable_test (void) { run_test = true; for (int i = 0; i < NUM_MOVER_THREADS; i++) { - r = toku_pthread_create(&read_random_tid[i], NULL, read_random_numbers, NULL); + r = toku_pthread_create(toku_uninstrumented, + &read_random_tid[i], + nullptr, + read_random_numbers, + nullptr); assert_zero(r); } for (int i = 0; i < NUM_MOVER_THREADS; i++) { - r = toku_pthread_create(&move_tid[i], NULL, move_numbers, NULL); + r = toku_pthread_create(toku_uninstrumented, + &move_tid[i], + nullptr, + move_numbers, + nullptr); assert_zero(r); } - r = toku_pthread_create(&checkpoint_tid, NULL, checkpoints, NULL); - assert_zero(r); - r = toku_pthread_create(&time_tid, NULL, test_time, NULL); + r = toku_pthread_create( + toku_uninstrumented, &checkpoint_tid, nullptr, checkpoints, nullptr); + assert_zero(r); + r = toku_pthread_create( + toku_uninstrumented, &time_tid, nullptr, test_time, nullptr); assert_zero(r); - void *ret; r = toku_pthread_join(time_tid, &ret); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc index afc95471116541f2f75891a4c3d22e8201a413ff..4cf1678449b080a5ef27ea5a328f22825f922ab3 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-put-checkpoint.cc @@ -518,19 +518,28 @@ cachetable_test (void) { run_test = true; for (int i = 0; i < NUM_MOVER_THREADS; i++) { - r = toku_pthread_create(&move_tid[i], NULL, move_numbers, NULL); + r = toku_pthread_create(toku_uninstrumented, + &move_tid[i], + nullptr, + move_numbers, + nullptr); assert_zero(r); } for (int i = 0; i < NUM_MOVER_THREADS; i++) { - r = toku_pthread_create(&merge_and_split_tid[i], NULL, merge_and_split, NULL); + r = toku_pthread_create(toku_uninstrumented, + &merge_and_split_tid[i], + nullptr, + merge_and_split, + nullptr); assert_zero(r); } - r = toku_pthread_create(&checkpoint_tid, NULL, checkpoints, NULL); - assert_zero(r); - r = toku_pthread_create(&time_tid, NULL, test_time, NULL); + r = toku_pthread_create( + toku_uninstrumented, &checkpoint_tid, nullptr, checkpoints, nullptr); + assert_zero(r); + r = toku_pthread_create( + toku_uninstrumented, &time_tid, nullptr, test_time, nullptr); assert_zero(r); - void *ret; r = toku_pthread_join(time_tid, &ret); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-rwlock-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-rwlock-test.cc index 9a62f99e1fa7bf1eb4e701e5548467592d39a405..6d8bc28026c7c5ce1eaab2e53646ac44266c4643 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-rwlock-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-rwlock-test.cc @@ -40,24 +40,22 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. // test create and destroy -static void -test_create_destroy (void) { - struct rwlock the_rwlock, *rwlock = &the_rwlock; +static void test_create_destroy(void) { + struct st_rwlock the_rwlock, *rwlock = &the_rwlock; - rwlock_init(rwlock); + rwlock_init(toku_uninstrumented, rwlock); rwlock_destroy(rwlock); } // test read lock and unlock with no writers -static void -test_simple_read_lock (int n) { - struct rwlock the_rwlock, *rwlock = &the_rwlock; +static void test_simple_read_lock(int n) { + struct st_rwlock the_rwlock, *rwlock = &the_rwlock; - rwlock_init(rwlock); + rwlock_init(toku_uninstrumented, rwlock); assert(rwlock_readers(rwlock) == 0); int i; - for (i=1; i<=n; i++) { + for (i = 1; i <= n; i++) { rwlock_read_lock(rwlock, 0); assert(rwlock_readers(rwlock) == i); assert(rwlock_users(rwlock) == i); @@ -72,11 +70,10 @@ test_simple_read_lock (int n) { // test write lock and unlock with no readers -static void -test_simple_write_lock (void) { - struct rwlock the_rwlock, *rwlock = &the_rwlock; +static void test_simple_write_lock(void) { + struct st_rwlock the_rwlock, *rwlock = &the_rwlock; - rwlock_init(rwlock); + rwlock_init(toku_uninstrumented, rwlock); assert(rwlock_users(rwlock) == 0); rwlock_write_lock(rwlock, 0); assert(rwlock_writers(rwlock) == 1); @@ -88,19 +85,17 @@ test_simple_write_lock (void) { struct rw_event { int e; - struct rwlock the_rwlock; + struct st_rwlock the_rwlock; toku_mutex_t mutex; }; -static void -rw_event_init (struct rw_event *rwe) { +static void rw_event_init(struct rw_event *rwe) { rwe->e = 0; - rwlock_init(&rwe->the_rwlock); - toku_mutex_init(&rwe->mutex, 0); + rwlock_init(toku_uninstrumented, &rwe->the_rwlock); + toku_mutex_init(toku_uninstrumented, &rwe->mutex, nullptr); } -static void -rw_event_destroy (struct rw_event *rwe) { +static void rw_event_destroy(struct rw_event *rwe) { rwlock_destroy(&rwe->the_rwlock); toku_mutex_destroy(&rwe->mutex); } @@ -138,10 +133,12 @@ test_writer_priority (void) { toku_mutex_unlock(&rwe->mutex); toku_pthread_t tid; - r = toku_pthread_create(&tid, 0, test_writer_priority_thread, rwe); + r = toku_pthread_create( + toku_uninstrumented, &tid, 0, test_writer_priority_thread, rwe); sleep(1); toku_mutex_lock(&rwe->mutex); - rwe->e++; assert(rwe->e == 2); + rwe->e++; + assert(rwe->e == 2); toku_mutex_unlock(&rwe->mutex); sleep(1); @@ -196,10 +193,12 @@ test_single_writer (void) { toku_mutex_unlock(&rwe->mutex); toku_pthread_t tid; - r = toku_pthread_create(&tid, 0, test_single_writer_thread, rwe); + r = toku_pthread_create( + toku_uninstrumented, &tid, 0, test_single_writer_thread, rwe); sleep(1); toku_mutex_lock(&rwe->mutex); - rwe->e++; assert(rwe->e == 2); + rwe->e++; + assert(rwe->e == 2); assert(rwlock_writers(&rwe->the_rwlock) == 1); assert(rwlock_users(&rwe->the_rwlock) == 2); rwlock_write_unlock(&rwe->the_rwlock); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc index 8fd8828737aed5736886785f0ea51b877f8dc77d..ebe05e5088341a5808f115d50b604934aeb82efd 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin-nonblocking.cc @@ -111,9 +111,20 @@ run_test (void) { toku_pthread_t fetch_tid; fetch_called = false; - r = toku_pthread_create(&fetch_tid, NULL, run_expensive_fetch, NULL); + r = toku_pthread_create( + toku_uninstrumented, &fetch_tid, nullptr, run_expensive_fetch, nullptr); sleep(1); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + 1, + &v1, + &s1, + wc, + sleep_fetch, + def_pf_req_callback, + def_pf_callback, + false, + NULL); assert_zero(r); assert(fetch_called); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); @@ -133,9 +144,20 @@ run_test (void) { toku_pthread_t pf_tid; pf_called = false; - r = toku_pthread_create(&pf_tid, NULL, run_expensive_pf, NULL); + r = toku_pthread_create( + toku_uninstrumented, &pf_tid, nullptr, run_expensive_pf, nullptr); sleep(1); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + 1, + &v1, + &s1, + wc, + sleep_fetch, + def_pf_req_callback, + def_pf_callback, + false, + NULL); assert_zero(r); assert(pf_called); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc index 63ca871a459d95ab6dce355160760626522bc695..dd5d59df002ed26a0959fb4c4e5ac2810b074487 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-simple-read-pin.cc @@ -117,9 +117,20 @@ run_test (void) { toku_pthread_t fetch_tid; fetch_called = false; - r = toku_pthread_create(&fetch_tid, NULL, run_expensive_fetch, NULL); + r = toku_pthread_create( + toku_uninstrumented, &fetch_tid, nullptr, run_expensive_fetch, nullptr); sleep(1); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + 1, + &v1, + &s1, + wc, + sleep_fetch, + def_pf_req_callback, + def_pf_callback, + false, + NULL); assert_zero(r); assert(fetch_called); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); @@ -141,9 +152,20 @@ run_test (void) { toku_pthread_t pf_tid; pf_called = false; - r = toku_pthread_create(&pf_tid, NULL, run_expensive_pf, NULL); + r = toku_pthread_create( + toku_uninstrumented, &pf_tid, nullptr, run_expensive_pf, nullptr); sleep(1); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, wc, sleep_fetch, def_pf_req_callback, def_pf_callback, false, NULL); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + 1, + &v1, + &s1, + wc, + sleep_fetch, + def_pf_req_callback, + def_pf_callback, + false, + NULL); assert_zero(r); assert(pf_called); r = toku_test_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc index e4bb5fb0aeaf0dc1df8af800ad148bbd05c1d5a8..64f688c470d3ff4ec6cadecabf194453898c9770 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-test.cc @@ -42,15 +42,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. // global data, especially between the test thread and the cachetable // writeback threads -toku_mutex_t test_mutex; +toku_mutex_t test_mutex; static inline void test_mutex_init(void) { - toku_mutex_init(&test_mutex, 0); + toku_mutex_init(toku_uninstrumented, &test_mutex, nullptr); } -static inline void test_mutex_destroy(void) { - toku_mutex_destroy(&test_mutex); -} +static inline void test_mutex_destroy(void) { toku_mutex_destroy(&test_mutex); } static inline void test_mutex_lock(void) { toku_mutex_lock(&test_mutex); diff --git a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc index 11baa36e51bf8da117ff8af3f8a94a42745b43b9..0e44bf10349cda2dcc3f0d537cb8b12673b552e8 100644 --- a/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc +++ b/storage/tokudb/PerconaFT/ft/tests/cachetable-unpin-remove-and-checkpoint.cc @@ -86,11 +86,22 @@ run_test (void) { // now this should mark the pair for checkpoint CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct); toku_cachetable_begin_checkpoint(cp, NULL); - r = toku_cachetable_get_and_pin(f1, make_blocknum(1), toku_cachetable_hash(f1, make_blocknum(1)), &v1, &s1, wc, def_fetch, def_pf_req_callback, def_pf_callback, true, NULL); + r = toku_cachetable_get_and_pin(f1, + make_blocknum(1), + toku_cachetable_hash(f1, make_blocknum(1)), + &v1, + &s1, + wc, + def_fetch, + def_pf_req_callback, + def_pf_callback, + true, + NULL); toku_pthread_t mytid; - r = toku_pthread_create(&mytid, NULL, run_end_chkpt, NULL); - assert(r==0); + r = toku_pthread_create( + toku_uninstrumented, &mytid, nullptr, run_end_chkpt, nullptr); + assert(r == 0); // give checkpoint thread a chance to start waiting on lock sleep(1); diff --git a/storage/tokudb/PerconaFT/ft/tests/ftloader-test-extractor-errors.cc b/storage/tokudb/PerconaFT/ft/tests/ftloader-test-extractor-errors.cc index 872b674c78410b2a3596ea38c4bcc872495c102f..4bff52ceb1bde1f45392ea655266012b913a0b2f 100644 --- a/storage/tokudb/PerconaFT/ft/tests/ftloader-test-extractor-errors.cc +++ b/storage/tokudb/PerconaFT/ft/tests/ftloader-test-extractor-errors.cc @@ -141,7 +141,7 @@ static void test_extractor(int nrows, int nrowsets, bool expect_fail, const char // setup error injection toku_set_func_malloc(my_malloc); toku_set_func_realloc(my_realloc); - ft_loader_set_os_fwrite(bad_fwrite); + toku_set_func_fwrite(bad_fwrite); toku_set_func_write(bad_write); toku_set_func_pwrite(bad_pwrite); ft_loader_set_poll_function(&loader->poll_callback, loader_poll_callback, NULL); @@ -157,7 +157,7 @@ static void test_extractor(int nrows, int nrowsets, bool expect_fail, const char toku_set_func_malloc(NULL); toku_set_func_realloc(NULL); - ft_loader_set_os_fwrite(NULL); + toku_set_func_fwrite(nullptr); toku_set_func_write(NULL); toku_set_func_pwrite(NULL); diff --git a/storage/tokudb/PerconaFT/ft/tests/ftloader-test-merge-files-dbufio.cc b/storage/tokudb/PerconaFT/ft/tests/ftloader-test-merge-files-dbufio.cc index d1aeff198ff9089f7b79d4c60870bc928e79deaa..0b1213167384795e42442ea325ab591660e92b65 100644 --- a/storage/tokudb/PerconaFT/ft/tests/ftloader-test-merge-files-dbufio.cc +++ b/storage/tokudb/PerconaFT/ft/tests/ftloader-test-merge-files-dbufio.cc @@ -393,13 +393,17 @@ static void test (const char *directory, bool is_error) { toku_pthread_t consumer; struct consumer_thunk cthunk = {q, 0}; { - int r = toku_pthread_create(&consumer, NULL, consumer_thread, (void*)&cthunk); - assert(r==0); + int r = toku_pthread_create(toku_uninstrumented, + &consumer, + nullptr, + consumer_thread, + static_cast(&cthunk)); + assert(r == 0); } toku_set_func_malloc_only(my_malloc); toku_set_func_realloc_only(my_realloc); - ft_loader_set_os_fwrite(bad_fwrite); + toku_set_func_fwrite(bad_fwrite); toku_set_func_write(bad_write); toku_set_func_pwrite(bad_pwrite); toku_set_func_fdopen(bad_fdopen); @@ -427,7 +431,7 @@ static void test (const char *directory, bool is_error) { toku_set_func_malloc(NULL); toku_set_func_realloc(NULL); - ft_loader_set_os_fwrite(NULL); + toku_set_func_fwrite(nullptr); toku_set_func_write(NULL); toku_set_func_pwrite(NULL); toku_set_func_fdopen(NULL); diff --git a/storage/tokudb/PerconaFT/ft/tests/ftloader-test-writer-errors.cc b/storage/tokudb/PerconaFT/ft/tests/ftloader-test-writer-errors.cc index 0784ca87a26d1403fd0bb42b0d5dd10de4dd3250..e4423319518ac1ab0b11dd695ffdde4078733591 100644 --- a/storage/tokudb/PerconaFT/ft/tests/ftloader-test-writer-errors.cc +++ b/storage/tokudb/PerconaFT/ft/tests/ftloader-test-writer-errors.cc @@ -154,7 +154,7 @@ static int write_dbfile (char *tf_template, int n, char *output_name, bool expec toku_set_func_malloc_only(my_malloc); toku_set_func_realloc_only(my_realloc); - ft_loader_set_os_fwrite(bad_fwrite); + toku_set_func_fwrite(bad_fwrite); toku_set_func_write(bad_write); toku_set_func_pwrite(bad_pwrite); ft_loader_set_error_function(&bl.error_callback, NULL, NULL); @@ -164,7 +164,7 @@ static int write_dbfile (char *tf_template, int n, char *output_name, bool expec toku_set_func_malloc_only(NULL); toku_set_func_realloc_only(NULL); - ft_loader_set_os_fwrite(NULL); + toku_set_func_fwrite(nullptr); toku_set_func_write(NULL); toku_set_func_pwrite(NULL); diff --git a/storage/tokudb/PerconaFT/ft/tests/log-test4.cc b/storage/tokudb/PerconaFT/ft/tests/log-test4.cc index a31181deb309406b8f7d1d686f7b9d212703d8fd..e0bbedb95bf763e06d97e008434475d6b3f268a3 100644 --- a/storage/tokudb/PerconaFT/ft/tests/log-test4.cc +++ b/storage/tokudb/PerconaFT/ft/tests/log-test4.cc @@ -63,11 +63,14 @@ test_main (int argc __attribute__((__unused__)), r = toku_logger_close(&logger); assert(r == 0); { - toku_struct_stat statbuf; - sprintf(logname, "%s/log000000000000.tokulog%d", TOKU_TEST_FILENAME, TOKU_LOG_VERSION); - r = toku_stat(logname, &statbuf); - assert(r==0); - assert(statbuf.st_size==12+5); + toku_struct_stat statbuf; + sprintf(logname, + "%s/log000000000000.tokulog%d", + TOKU_TEST_FILENAME, + TOKU_LOG_VERSION); + r = toku_stat(logname, &statbuf, toku_uninstrumented); + assert(r == 0); + assert(statbuf.st_size == 12 + 5); } toku_os_recursive_delete(TOKU_TEST_FILENAME); return 0; diff --git a/storage/tokudb/PerconaFT/ft/tests/log-test5.cc b/storage/tokudb/PerconaFT/ft/tests/log-test5.cc index d4e31af22dcc5e71e580389bc143563c520c633f..fed9467a4aed0da517b281d2e44da0f7f5e23ea3 100644 --- a/storage/tokudb/PerconaFT/ft/tests/log-test5.cc +++ b/storage/tokudb/PerconaFT/ft/tests/log-test5.cc @@ -81,14 +81,14 @@ test_main (int argc __attribute__((__unused__)), struct dirent *dirent; while ((dirent=readdir(dir))) { if (strncmp(dirent->d_name, "log", 3)!=0) continue; - char fname[TOKU_PATH_MAX+1]; - toku_path_join(fname, 2, TOKU_TEST_FILENAME, dirent->d_name); - toku_struct_stat statbuf; - r = toku_stat(fname, &statbuf); - assert(r==0); - assert(statbuf.st_size<=LSIZE+10); - } - r = closedir(dir); + char fname[TOKU_PATH_MAX + 1]; + toku_path_join(fname, 2, TOKU_TEST_FILENAME, dirent->d_name); + toku_struct_stat statbuf; + r = toku_stat(fname, &statbuf, toku_uninstrumented); + assert(r == 0); + assert(statbuf.st_size <= LSIZE + 10); + } + r = closedir(dir); assert(r==0); } toku_os_recursive_delete(TOKU_TEST_FILENAME); diff --git a/storage/tokudb/PerconaFT/ft/tests/log-test6.cc b/storage/tokudb/PerconaFT/ft/tests/log-test6.cc index 4d17488c57c5ed1d75e557f13aec3144325a113a..0e8b94566df831560434a346b91e49b67366b6f2 100644 --- a/storage/tokudb/PerconaFT/ft/tests/log-test6.cc +++ b/storage/tokudb/PerconaFT/ft/tests/log-test6.cc @@ -86,11 +86,14 @@ test_main (int argc __attribute__((__unused__)), { char logname[PATH_MAX]; - toku_struct_stat statbuf; - sprintf(logname, "%s/log000000000000.tokulog%d", TOKU_TEST_FILENAME, TOKU_LOG_VERSION); - r = toku_stat(logname, &statbuf); - assert(r==0); - assert(statbuf.st_size<=LSIZE); + toku_struct_stat statbuf; + sprintf(logname, + "%s/log000000000000.tokulog%d", + TOKU_TEST_FILENAME, + TOKU_LOG_VERSION); + r = toku_stat(logname, &statbuf, toku_uninstrumented); + assert(r == 0); + assert(statbuf.st_size <= LSIZE); } toku_os_recursive_delete(TOKU_TEST_FILENAME); return 0; diff --git a/storage/tokudb/PerconaFT/ft/tests/recovery-bad-last-entry.cc b/storage/tokudb/PerconaFT/ft/tests/recovery-bad-last-entry.cc index 431ee4b5e50ccd99a0dd9684589e12f6385afd62..a3c934d1f4bd978cfda0477a6630c834717af7b6 100644 --- a/storage/tokudb/PerconaFT/ft/tests/recovery-bad-last-entry.cc +++ b/storage/tokudb/PerconaFT/ft/tests/recovery-bad-last-entry.cc @@ -83,11 +83,16 @@ run_test(void) { r = toku_dup2(devnul, fileno(stderr)); assert(r==fileno(stderr)); r = close(devnul); assert(r==0); - char fname[TOKU_PATH_MAX+1]; - sprintf(fname, "%s/%s%d", TOKU_TEST_FILENAME, "log000000000000.tokulog", TOKU_LOG_VERSION); - - r = toku_stat(fname, &st); assert(r==0); - if ( st.st_size - trim > magic_begin_end_checkpoint_sz ) { + char fname[TOKU_PATH_MAX + 1]; + sprintf(fname, + "%s/%s%d", + TOKU_TEST_FILENAME, + "log000000000000.tokulog", + TOKU_LOG_VERSION); + + r = toku_stat(fname, &st, toku_uninstrumented); + assert(r == 0); + if (st.st_size - trim > magic_begin_end_checkpoint_sz) { r = truncate(fname, st.st_size - trim); CKERR(r); } diff --git a/storage/tokudb/PerconaFT/ft/tests/test-bjm.cc b/storage/tokudb/PerconaFT/ft/tests/test-bjm.cc index 97e00c42b956f85225b4dc02691da2f6aeb5869d..6afe5b9f7c41647cf7aab7943924c84ecf72e805 100644 --- a/storage/tokudb/PerconaFT/ft/tests/test-bjm.cc +++ b/storage/tokudb/PerconaFT/ft/tests/test-bjm.cc @@ -71,12 +71,16 @@ static void bjm_test(void) { bjm_reset(bjm); r = bjm_add_background_job(bjm); - assert_zero(r); - toku_pthread_t tid; - r = toku_pthread_create(&tid, NULL, finish_bjm, NULL); assert_zero(r); - usleep(2*1024*1024); - // should return non-zero because tid is waiting + toku_pthread_t tid; + r = toku_pthread_create(toku_uninstrumented, + &tid, + nullptr, + finish_bjm, + nullptr); + assert_zero(r); + usleep(2 * 1024 * 1024); + // should return non-zero because tid is waiting // for background jobs to finish r = bjm_add_background_job(bjm); assert(r != 0); diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc index 3e5d9bba817e93921172e3441719acbfafca9bb6..06a2661488515d9c1647a20af562e5928758bc63 100644 --- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc +++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-flush.cc @@ -113,10 +113,14 @@ static void flusher_callback(int state, void* extra) { if ((state == flt_flush_before_child_pin && !after_child_pin) || (state == ft_flush_aflter_child_pin && after_child_pin)) { checkpoint_called = true; - int r = toku_pthread_create(&checkpoint_tid, NULL, do_checkpoint, NULL); + int r = toku_pthread_create(toku_uninstrumented, + &checkpoint_tid, + nullptr, + do_checkpoint, + nullptr); assert_zero(r); while (!checkpoint_callback_called) { - usleep(1*1024*1024); + usleep(1 * 1024 * 1024); } } } diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc index cb316127ef7825cc6a2345c7b13a24c23c1d841c..1029dfef320dbe102f21e7978614a0eb9780a161 100644 --- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc +++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-merge.cc @@ -103,10 +103,14 @@ static void flusher_callback(int state, void* extra) { } if (state == desired_state) { checkpoint_called = true; - int r = toku_pthread_create(&checkpoint_tid, NULL, do_checkpoint, NULL); + int r = toku_pthread_create(toku_uninstrumented, + &checkpoint_tid, + nullptr, + do_checkpoint, + nullptr); assert_zero(r); while (!checkpoint_callback_called) { - usleep(1*1024*1024); + usleep(1 * 1024 * 1024); } } } diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc index 5f8485ac4ec746a22c538f1a94a944d2568e55e6..208ebe3ca318492ea9260629b9fc07c65f4d201b 100644 --- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc +++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-rebalance.cc @@ -103,10 +103,14 @@ static void flusher_callback(int state, void* extra) { } if (state == desired_state) { checkpoint_called = true; - int r = toku_pthread_create(&checkpoint_tid, NULL, do_checkpoint, NULL); + int r = toku_pthread_create(toku_uninstrumented, + &checkpoint_tid, + nullptr, + do_checkpoint, + nullptr); assert_zero(r); while (!checkpoint_callback_called) { - usleep(1*1024*1024); + usleep(1 * 1024 * 1024); } } } diff --git a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc index 70c3ba22a0c992475e62fc838d30294f1ffd19e0..2b29de409b12041c07c20d6568472eaa8b6da839 100644 --- a/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc +++ b/storage/tokudb/PerconaFT/ft/tests/test-checkpoint-during-split.cc @@ -113,10 +113,14 @@ static void flusher_callback(int state, void* extra) { if ((state == flt_flush_before_split && !after_split) || (state == flt_flush_during_split && after_split)) { checkpoint_called = true; - int r = toku_pthread_create(&checkpoint_tid, NULL, do_checkpoint, NULL); + int r = toku_pthread_create(toku_uninstrumented, + &checkpoint_tid, + nullptr, + do_checkpoint, + nullptr); assert_zero(r); while (!checkpoint_callback_called) { - usleep(1*1024*1024); + usleep(1 * 1024 * 1024); } } } diff --git a/storage/tokudb/PerconaFT/ft/tests/test3681.cc b/storage/tokudb/PerconaFT/ft/tests/test3681.cc index e5e24a8824675e038b6cbff79c58c4e24375903d..9e4a46e8dfecf1ffe0cdfe8fdb4d5398e4b4bbc6 100644 --- a/storage/tokudb/PerconaFT/ft/tests/test3681.cc +++ b/storage/tokudb/PerconaFT/ft/tests/test3681.cc @@ -91,13 +91,35 @@ static void *startb (void *n) { return NULL; } -static void test3681 (void) { +static void test3681(void) { setup(); - toku_pthread_t a,b; - { int r; r = toku_pthread_create(&a, NULL, starta, NULL); assert(r==0); } - { int r; r = toku_pthread_create(&b, NULL, startb, NULL); assert(r==0); } - { int r; void *v; r = toku_pthread_join(a, &v); assert(r==0); assert(v==NULL); } - { int r; void *v; r = toku_pthread_join(b, &v); assert(r==0); assert(v==NULL); } + toku_pthread_t a, b; + { + int r; + r = toku_pthread_create( + toku_uninstrumented, &a, nullptr, starta, nullptr); + assert(r == 0); + } + { + int r; + r = toku_pthread_create( + toku_uninstrumented, &b, nullptr, startb, nullptr); + assert(r == 0); + } + { + int r; + void *v; + r = toku_pthread_join(a, &v); + assert(r == 0); + assert(v == NULL); + } + { + int r; + void *v; + r = toku_pthread_join(b, &v); + assert(r == 0); + assert(v == NULL); + } finish(); } diff --git a/storage/tokudb/PerconaFT/ft/txn/roll.cc b/storage/tokudb/PerconaFT/ft/txn/roll.cc index 97afd2f5bdb72f787071456da7eea3985a0f78fe..7228de06f34ed8f886cd69eeb2550b11541388b6 100644 --- a/storage/tokudb/PerconaFT/ft/txn/roll.cc +++ b/storage/tokudb/PerconaFT/ft/txn/roll.cc @@ -195,14 +195,14 @@ int toku_rollback_frename(BYTESTRING old_iname, toku_cachetable_get_fname_in_cwd(cachetable, new_iname.data), &toku_free); - if (toku_stat(old_iname_full.get(), &stat) == -1) { + if (toku_stat(old_iname_full.get(), &stat, toku_uninstrumented) == -1) { if (ENOENT == errno) old_exist = false; else return 1; } - if (toku_stat(new_iname_full.get(), &stat) == -1) { + if (toku_stat(new_iname_full.get(), &stat, toku_uninstrumented) == -1) { if (ENOENT == errno || ENAMETOOLONG == errno) new_exist = false; else @@ -220,7 +220,7 @@ int toku_rollback_frename(BYTESTRING old_iname, // removed // and the new file is renamed. if (old_exist && new_exist && - (toku_os_unlink(old_iname_full.get()) == -1 || + (toku_os_delete(old_iname_full.get()) == -1 || toku_os_rename(new_iname_full.get(), old_iname_full.get()) == -1 || toku_fsync_directory(new_iname_full.get()) == -1 || toku_fsync_directory(old_iname_full.get()) == -1)) diff --git a/storage/tokudb/PerconaFT/ft/txn/rollback_log_node_cache.cc b/storage/tokudb/PerconaFT/ft/txn/rollback_log_node_cache.cc index 71b1e79277c6eae09850713c0faf657fc3ffb3d8..5e1ab746936ee1512ccad1764db57777c2409698 100644 --- a/storage/tokudb/PerconaFT/ft/txn/rollback_log_node_cache.cc +++ b/storage/tokudb/PerconaFT/ft/txn/rollback_log_node_cache.cc @@ -41,7 +41,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "txn/rollback_log_node_cache.h" -void rollback_log_node_cache::init (uint32_t max_num_avail_nodes) { +toku_instr_key* rollback_log_node_cache_mutex_key; + +void rollback_log_node_cache::init(uint32_t max_num_avail_nodes) { XMALLOC_N(max_num_avail_nodes, m_avail_blocknums); m_max_num_avail = max_num_avail_nodes; m_first = 0; @@ -49,7 +51,7 @@ void rollback_log_node_cache::init (uint32_t max_num_avail_nodes) { toku_pthread_mutexattr_t attr; toku_mutexattr_init(&attr); toku_mutexattr_settype(&attr, TOKU_MUTEX_ADAPTIVE); - toku_mutex_init(&m_mutex, &attr); + toku_mutex_init(*rollback_log_node_cache_mutex_key, &m_mutex, &attr); toku_mutexattr_destroy(&attr); } diff --git a/storage/tokudb/PerconaFT/ft/txn/txn.cc b/storage/tokudb/PerconaFT/ft/txn/txn.cc index a3ce6beb7b088eb1e03b6ca487adcf599062ebc9..7327cbd9d24162928d029da5315d6b770e1b2ded 100644 --- a/storage/tokudb/PerconaFT/ft/txn/txn.cc +++ b/storage/tokudb/PerconaFT/ft/txn/txn.cc @@ -45,8 +45,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ft/txn/txn_manager.h" #include "util/status.h" -void -toku_txn_get_status(TXN_STATUS s) { +toku_instr_key *txn_lock_mutex_key; +toku_instr_key *txn_state_lock_mutex_key; +toku_instr_key *result_state_cond_key; + +void toku_txn_get_status(TXN_STATUS s) { txn_status.init(); *s = txn_status; } @@ -225,74 +228,74 @@ static void toku_txn_create_txn ( static txn_child_manager tcm; - struct tokutxn new_txn = { - .txnid = {.parent_id64 = TXNID_NONE, .child_id64 = TXNID_NONE }, - .snapshot_txnid64 = TXNID_NONE, - .snapshot_type = for_recovery ? TXN_SNAPSHOT_NONE : snapshot_type, - .for_recovery = for_recovery, - .logger = logger, - .parent = parent_tokutxn, - .child = NULL, - .child_manager_s = tcm, - .child_manager = NULL, - .container_db_txn = container_db_txn, - .live_root_txn_list = nullptr, - .xids = NULL, - .snapshot_next = NULL, - .snapshot_prev = NULL, - .begin_was_logged = false, - .declared_read_only = read_only, - .do_fsync = false, - .force_fsync_on_commit = false, - .do_fsync_lsn = ZERO_LSN, - .xa_xid = {0, 0, 0, ""}, - .progress_poll_fun = NULL, - .progress_poll_fun_extra = NULL, - - // You cannot initialize txn_lock a TOKU_MUTEX_INITIALIZER, because we - // will initialize it in the code below, and it cannot already - // be initialized at that point. Also, in general, you don't - // get to use PTHREAD_MUTEX_INITALIZER (which is what is inside - // TOKU_MUTEX_INITIALIZER) except in static variables, and this - // is initializing an auto variable. - // - // And we cannot simply avoid initializing these fields - // because, although it avoids -Wmissing-field-initializer - // errors under gcc, it gets other errors about non-trivial - // designated initializers not being supported. - - .txn_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER - .open_fts = open_fts, - .roll_info = roll_info, - .state_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER - .state_cond = ZERO_COND_INITIALIZER, // Not TOKU_COND_INITIALIZER - .state = TOKUTXN_LIVE, - .num_pin = 0, - .client_id = 0, - .client_extra = nullptr, - .start_time = time(NULL), - }; +struct tokutxn new_txn = { + .txnid = {.parent_id64 = TXNID_NONE, .child_id64 = TXNID_NONE }, + .snapshot_txnid64 = TXNID_NONE, + .snapshot_type = for_recovery ? TXN_SNAPSHOT_NONE : snapshot_type, + .for_recovery = for_recovery, + .logger = logger, + .parent = parent_tokutxn, + .child = NULL, + .child_manager_s = tcm, + .child_manager = NULL, + .container_db_txn = container_db_txn, + .live_root_txn_list = nullptr, + .xids = NULL, + .snapshot_next = NULL, + .snapshot_prev = NULL, + .begin_was_logged = false, + .declared_read_only = read_only, + .do_fsync = false, + .force_fsync_on_commit = false, + .do_fsync_lsn = ZERO_LSN, + .xa_xid = {0, 0, 0, ""}, + .progress_poll_fun = NULL, + .progress_poll_fun_extra = NULL, + + // You cannot initialize txn_lock a TOKU_MUTEX_INITIALIZER, because we + // will initialize it in the code below, and it cannot already + // be initialized at that point. Also, in general, you don't + // get to use PTHREAD_MUTEX_INITALIZER (which is what is inside + // TOKU_MUTEX_INITIALIZER) except in static variables, and this + // is initializing an auto variable. + // + // And we cannot simply avoid initializing these fields + // because, although it avoids -Wmissing-field-initializer + // errors under gcc, it gets other errors about non-trivial + // designated initializers not being supported. + + .txn_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER + .open_fts = open_fts, + .roll_info = roll_info, + .state_lock = ZERO_MUTEX_INITIALIZER, // Not TOKU_MUTEX_INITIALIZER + .state_cond = ZERO_COND_INITIALIZER, // Not TOKU_COND_INITIALIZER + .state = TOKUTXN_LIVE, + .num_pin = 0, + .client_id = 0, + .client_extra = nullptr, + .start_time = time(NULL), +}; - TOKUTXN result = NULL; - XMEMDUP(result, &new_txn); - invalidate_xa_xid(&result->xa_xid); - if (parent_tokutxn == NULL) { - result->child_manager = &result->child_manager_s; - result->child_manager->init(result); +TOKUTXN result = NULL; +XMEMDUP(result, &new_txn); +invalidate_xa_xid(&result->xa_xid); +if (parent_tokutxn == NULL) { + result->child_manager = &result->child_manager_s; + result->child_manager->init(result); } else { result->child_manager = parent_tokutxn->child_manager; } - toku_mutex_init(&result->txn_lock, nullptr); + toku_mutex_init(*txn_lock_mutex_key, &result->txn_lock, nullptr); toku_pthread_mutexattr_t attr; toku_mutexattr_init(&attr); toku_mutexattr_settype(&attr, TOKU_MUTEX_ADAPTIVE); - toku_mutex_init(&result->state_lock, &attr); + toku_mutex_init(*txn_state_lock_mutex_key, &result->state_lock, &attr); toku_mutexattr_destroy(&attr); - toku_cond_init(&result->state_cond, nullptr); + toku_cond_init(*result_state_cond_key, &result->state_cond, nullptr); *tokutxn = result; diff --git a/storage/tokudb/PerconaFT/ft/txn/txn_child_manager.cc b/storage/tokudb/PerconaFT/ft/txn/txn_child_manager.cc index db110127c552026ae57c75bb202a0af8bd649bca..99a21331b0a735fb542cee9da7e4ca97f2f9c308 100644 --- a/storage/tokudb/PerconaFT/ft/txn/txn_child_manager.cc +++ b/storage/tokudb/PerconaFT/ft/txn/txn_child_manager.cc @@ -39,6 +39,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ft/logger/log-internal.h" #include "ft/txn/txn_child_manager.h" +toku_instr_key *txn_child_manager_mutex_key; + // // initialized a txn_child_manager, // when called, root->txnid.parent_id64 may not yet be set @@ -53,7 +55,7 @@ void txn_child_manager::init(TOKUTXN root) { toku_pthread_mutexattr_t attr; toku_mutexattr_init(&attr); toku_mutexattr_settype(&attr, TOKU_MUTEX_ADAPTIVE); - toku_mutex_init(&m_mutex, &attr); + toku_mutex_init(*txn_child_manager_mutex_key, &m_mutex, &attr); toku_mutexattr_destroy(&attr); } diff --git a/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc b/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc index 88eca36a261b971039054e31441c5085d26c4732..384a960b1f372527a2b90bc28ecf3615f5a93b3f 100644 --- a/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc +++ b/storage/tokudb/PerconaFT/ft/txn/txn_manager.cc @@ -56,7 +56,10 @@ void set_test_txn_sync_callback(void (*cb) (pthread_t, void *), void *extra) { } bool garbage_collection_debug = false; -static bool txn_records_snapshot(TXN_SNAPSHOT_TYPE snapshot_type, struct tokutxn *parent) { +toku_instr_key *txn_manager_lock_mutex_key; + +static bool txn_records_snapshot(TXN_SNAPSHOT_TYPE snapshot_type, + struct tokutxn *parent) { if (snapshot_type == TXN_COPIES_SNAPSHOT) { return false; } @@ -248,9 +251,10 @@ verify_snapshot_system(TXN_MANAGER txn_manager UU()) { live_root_txns_omt.destroy(); } -void toku_txn_manager_init(TXN_MANAGER* txn_managerp) { +void toku_txn_manager_init(TXN_MANAGER *txn_managerp) { TXN_MANAGER XCALLOC(txn_manager); - toku_mutex_init(&txn_manager->txn_manager_lock, NULL); + toku_mutex_init( + *txn_manager_lock_mutex_key, &txn_manager->txn_manager_lock, nullptr); txn_manager->live_root_txns.create(); txn_manager->live_root_ids.create(); txn_manager->snapshot_head = NULL; diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.cc b/storage/tokudb/PerconaFT/locktree/lock_request.cc index 0151b5bd466489708e8174132e523eb8acb0eb2d..c0829e3f4e1cf8c295d95f6f933f5d99b9d2fa20 100644 --- a/storage/tokudb/PerconaFT/locktree/lock_request.cc +++ b/storage/tokudb/PerconaFT/locktree/lock_request.cc @@ -62,7 +62,7 @@ void lock_request::create(void) { m_state = state::UNINITIALIZED; m_info = nullptr; - toku_cond_init(&m_wait_cond, nullptr); + toku_cond_init(*lock_request_m_wait_cond_key, &m_wait_cond, nullptr); m_start_test_callback = nullptr; m_start_before_pending_test_callback = nullptr; diff --git a/storage/tokudb/PerconaFT/locktree/locktree.cc b/storage/tokudb/PerconaFT/locktree/locktree.cc index 2fbf078bdd641f960632b111c74f3b867d291a12..069aae26f664b3ad2cb09739362e29476adf2c69 100644 --- a/storage/tokudb/PerconaFT/locktree/locktree.cc +++ b/storage/tokudb/PerconaFT/locktree/locktree.cc @@ -51,7 +51,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. // the locktree source file instead of the header. #include "concurrent_tree.h" - namespace toku { // A locktree represents the set of row locks owned by all transactions @@ -87,12 +86,13 @@ void lt_lock_request_info::init(void) { pending_lock_requests.create(); pending_is_empty = true; ZERO_STRUCT(mutex); - toku_mutex_init(&mutex, nullptr); + toku_mutex_init(*locktree_request_info_mutex_key, &mutex, nullptr); retry_want = retry_done = 0; ZERO_STRUCT(counters); ZERO_STRUCT(retry_mutex); - toku_mutex_init(&retry_mutex, nullptr); - toku_cond_init(&retry_cv, nullptr); + toku_mutex_init( + *locktree_request_info_retry_mutex_key, &retry_mutex, nullptr); + toku_cond_init(*locktree_request_info_retry_cv_key, &retry_cv, nullptr); running_retry = false; TOKU_VALGRIND_HG_DISABLE_CHECKING(&pending_is_empty, diff --git a/storage/tokudb/PerconaFT/locktree/manager.cc b/storage/tokudb/PerconaFT/locktree/manager.cc index 91ff7c5a007c88c0f6ec2d7530ac5708a62a0529..6bb5c77bf32be12d424a1e52bc929135c39e8750 100644 --- a/storage/tokudb/PerconaFT/locktree/manager.cc +++ b/storage/tokudb/PerconaFT/locktree/manager.cc @@ -56,9 +56,8 @@ void locktree_manager::create(lt_create_cb create_cb, lt_destroy_cb destroy_cb, m_lt_destroy_callback = destroy_cb; m_lt_escalate_callback = escalate_cb; m_lt_escalate_callback_extra = escalate_extra; - ZERO_STRUCT(m_mutex); - toku_mutex_init(&m_mutex, nullptr); + toku_mutex_init(*manager_mutex_key, &m_mutex, nullptr); ZERO_STRUCT(m_lt_counters); @@ -346,7 +345,8 @@ int locktree_manager::check_current_lock_constraints(bool big_txn) { void locktree_manager::escalator_init(void) { ZERO_STRUCT(m_escalation_mutex); - toku_mutex_init(&m_escalation_mutex, nullptr); + toku_mutex_init( + *manager_escalation_mutex_key, &m_escalation_mutex, nullptr); m_escalation_count = 0; m_escalation_time = 0; m_wait_escalation_count = 0; @@ -403,8 +403,8 @@ struct escalate_args { void locktree_manager::locktree_escalator::create(void) { ZERO_STRUCT(m_escalator_mutex); - toku_mutex_init(&m_escalator_mutex, nullptr); - toku_cond_init(&m_escalator_done, nullptr); + toku_mutex_init(*manager_escalator_mutex_key, &m_escalator_mutex, nullptr); + toku_cond_init(*manager_m_escalator_done_key, &m_escalator_done, nullptr); m_escalator_running = false; } diff --git a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_1big7lt_1small.cc b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_1big7lt_1small.cc index 6c143f963ba6b221319a28f338fc04de1d43057e..32029b5bddd7e42fb93bdd4f79d6be3b81530214 100644 --- a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_1big7lt_1small.cc +++ b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_1big7lt_1small.cc @@ -201,12 +201,14 @@ int main(int argc, const char *argv[]) { locktree *small_lt = mgr.get_lt(dict_id, dbt_comparator, nullptr); // create the worker threads - struct big_arg big_arg = { &mgr, big_lt, n_big, 1000 }; - r = toku_pthread_create(&big_id, nullptr, big_f, &big_arg); + struct big_arg big_arg = {&mgr, big_lt, n_big, 1000}; + r = toku_pthread_create( + toku_uninstrumented, &big_id, nullptr, big_f, &big_arg); assert(r == 0); - struct small_arg small_arg = { &mgr, small_lt, 2000, 0 }; - r = toku_pthread_create(&small_id, nullptr, small_f, &small_arg); + struct small_arg small_arg = {&mgr, small_lt, 2000, 0}; + r = toku_pthread_create( + toku_uninstrumented, &small_id, nullptr, small_f, &small_arg); assert(r == 0); // wait for some escalations to occur diff --git a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_1lt.cc b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_1lt.cc index 17eb07060d4ab55de8baef907da90afc527672eb..ff59a7bdd5c387fd7fc203fdd420dc8e9a99ab6f 100644 --- a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_1lt.cc +++ b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_1lt.cc @@ -169,8 +169,10 @@ int main(int argc, const char *argv[]) { struct arg big_arg[n_big]; pthread_t big_ids[n_big]; for (int i = 0; i < n_big; i++) { - big_arg[i] = { &mgr, lt[i % n_lt], (TXNID)(1000+i), i == 0 ? 1 : -1000000000 }; - r = toku_pthread_create(&big_ids[i], nullptr, big_f, &big_arg[i]); + big_arg[i] = { + &mgr, lt[i % n_lt], (TXNID)(1000 + i), i == 0 ? 1 : -1000000000}; + r = toku_pthread_create( + toku_uninstrumented, &big_ids[i], nullptr, big_f, &big_arg[i]); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_2lt.cc b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_2lt.cc index 4326e8fafc289d83861f44048f279fcec8495f1c..be1ddaba9d082f22faf1b32ca16ec4e3f2381ebb 100644 --- a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_2lt.cc +++ b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_2big_2lt.cc @@ -169,8 +169,10 @@ int main(int argc, const char *argv[]) { struct arg big_arg[n_big]; pthread_t big_ids[n_big]; for (int i = 0; i < n_big; i++) { - big_arg[i] = { &mgr, lt[i % n_lt], (TXNID)(1000+i), i == 0 ? 1 : -1000000000 }; - r = toku_pthread_create(&big_ids[i], nullptr, big_f, &big_arg[i]); + big_arg[i] = { + &mgr, lt[i % n_lt], (TXNID)(1000 + i), i == 0 ? 1 : -1000000000}; + r = toku_pthread_create( + toku_uninstrumented, &big_ids[i], nullptr, big_f, &big_arg[i]); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_stalls.cc b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_stalls.cc index d146d94e33721403858d04496bc44d389c203bf9..9dc9596a7ed0cb574d8a9ec07e57702fd5c658fb 100644 --- a/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_stalls.cc +++ b/storage/tokudb/PerconaFT/locktree/tests/locktree_escalation_stalls.cc @@ -182,9 +182,10 @@ int main(int argc, const char *argv[]) { locktree *lt_1 = mgr.get_lt(dict_id_1, dbt_comparator, nullptr); // create the worker threads - struct arg big_arg = { &mgr, lt_0, 1000 }; + struct arg big_arg = {&mgr, lt_0, 1000}; pthread_t big_id; - r = toku_pthread_create(&big_id, nullptr, big_f, &big_arg); + r = toku_pthread_create( + toku_uninstrumented, &big_id, nullptr, big_f, &big_arg); assert(r == 0); const int n_small = 7; @@ -192,8 +193,12 @@ int main(int argc, const char *argv[]) { struct arg small_args[n_small]; for (int i = 0; i < n_small; i++) { - small_args[i] = { &mgr, lt_1, (TXNID)(2000+i), i }; - r = toku_pthread_create(&small_ids[i], nullptr, small_f, &small_args[i]); + small_args[i] = {&mgr, lt_1, (TXNID)(2000 + i), i}; + r = toku_pthread_create(toku_uninstrumented, + &small_ids[i], + nullptr, + small_f, + &small_args[i]); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/locktree/tests/manager_parallel_locktree_get_release.cc b/storage/tokudb/PerconaFT/locktree/tests/manager_parallel_locktree_get_release.cc index ec9ef21583c869adf9a170aa0cd8ed58598cbe7b..08ce63140a598491e681775da814068e66ad0dc1 100644 --- a/storage/tokudb/PerconaFT/locktree/tests/manager_parallel_locktree_get_release.cc +++ b/storage/tokudb/PerconaFT/locktree/tests/manager_parallel_locktree_get_release.cc @@ -71,7 +71,8 @@ void manager_unit_test::test_reference_release_lt(void) { const int nthreads = 2; pthread_t ids[nthreads]; for (int i = 0; i < nthreads; i++) { - r = toku_pthread_create(&ids[i], nullptr, my_tester, &mgr); + r = toku_pthread_create( + toku_uninstrumented, &ids[i], nullptr, my_tester, &mgr); assert(r == 0); } for (int i = 0; i < nthreads; i++) { diff --git a/storage/tokudb/PerconaFT/locktree/treenode.cc b/storage/tokudb/PerconaFT/locktree/treenode.cc index 4f43291fe7614101079f18e583d94c0f925f493f..cc3a4969643bee311911a501ab1c244ebe0a9f28 100644 --- a/storage/tokudb/PerconaFT/locktree/treenode.cc +++ b/storage/tokudb/PerconaFT/locktree/treenode.cc @@ -38,9 +38,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include -void treenode::mutex_lock(void) { - toku_mutex_lock(&m_mutex); -} +// TODO: source location info might have to be pulled up one caller +// to be useful +void treenode::mutex_lock(void) { toku_mutex_lock(&m_mutex); } void treenode::mutex_unlock(void) { toku_mutex_unlock(&m_mutex); @@ -58,7 +58,7 @@ void treenode::init(const comparator *cmp) { toku_pthread_mutexattr_t attr; toku_mutexattr_init(&attr); toku_mutexattr_settype(&attr, TOKU_MUTEX_ADAPTIVE); - toku_mutex_init(&m_mutex, &attr); + toku_mutex_init(*treenode_mutex_key, &m_mutex, &attr); toku_mutexattr_destroy(&attr); m_left_child.set(nullptr); m_right_child.set(nullptr); diff --git a/storage/tokudb/PerconaFT/portability/CMakeLists.txt b/storage/tokudb/PerconaFT/portability/CMakeLists.txt index 4793db63cc1e8e487bc33b43bc79a1a75c7aefd5..e5576a5d463ca65b3601818902331af5b660d380 100644 --- a/storage/tokudb/PerconaFT/portability/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/portability/CMakeLists.txt @@ -8,6 +8,7 @@ set(tokuportability_srcs portability toku_assert toku_crash + toku_instr_mysql toku_path toku_pthread toku_time @@ -53,6 +54,10 @@ if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING) DESTINATION ${INSTALL_LIBDIR} COMPONENT tokukv_libs_shared ) +else () + set_property(SOURCE toku_pthread portability APPEND PROPERTY + COMPILE_DEFINITIONS MYSQL_TOKUDB_ENGINE=1 ) + target_link_libraries(${LIBTOKUPORTABILITY} LINK_PRIVATE mysys) endif () add_subdirectory(tests) diff --git a/storage/tokudb/PerconaFT/portability/file.cc b/storage/tokudb/PerconaFT/portability/file.cc index 0e3efc1a12afc60398d5b5e8db77577568ad8e81..485bfac8514cb390ce7628b6b6edaef7c67b487c 100644 --- a/storage/tokudb/PerconaFT/portability/file.cc +++ b/storage/tokudb/PerconaFT/portability/file.cc @@ -52,9 +52,12 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "toku_path.h" #include +toku_instr_key *tokudb_file_data_key; + static int toku_assert_on_write_enospc = 0; static const int toku_write_enospc_sleep = 1; -static uint64_t toku_write_enospc_last_report; // timestamp of most recent report to error log +static uint64_t toku_write_enospc_last_report; // timestamp of most recent + // report to error log static time_t toku_write_enospc_last_time; // timestamp of most recent ENOSPC static uint32_t toku_write_enospc_current; // number of threads currently blocked on ENOSPC static uint64_t toku_write_enospc_total; // total number of times ENOSPC was returned from an attempt to write @@ -142,11 +145,17 @@ static ssize_t (*t_full_pwrite)(int, const void *, size_t, off_t); static FILE * (*t_fdopen)(int, const char *); static FILE * (*t_fopen)(const char *, const char *); static int (*t_open)(const char *, int, int); -static int (*t_fclose)(FILE *); +static int (*t_fclose)(FILE *); static ssize_t (*t_read)(int, void *, size_t); static ssize_t (*t_pread)(int, void *, size_t, off_t); +static size_t (*os_fwrite_fun)(const void *, size_t, size_t, FILE *) = nullptr; + +void toku_set_func_fwrite( + size_t (*fwrite_fun)(const void *, size_t, size_t, FILE *)) { + os_fwrite_fun = fwrite_fun; +} -void toku_set_func_write (ssize_t (*write_fun)(int, const void *, size_t)) { +void toku_set_func_write(ssize_t (*write_fun)(int, const void *, size_t)) { t_write = write_fun; } @@ -186,9 +195,63 @@ void toku_set_func_pread (ssize_t (*pread_fun)(int, void *, size_t, off_t)) { t_pread = pread_fun; } -void -toku_os_full_write (int fd, const void *buf, size_t len) { - const char *bp = (const char *) buf; +int toku_os_delete_with_source_location(const char *name, + const char *src_file, + uint src_line) { + + toku_io_instrumentation io_annotation; + toku_instr_file_name_close_begin(io_annotation, + *tokudb_file_data_key, + toku_instr_file_op::file_delete, + name, + src_file, + src_line); + const int result = unlink(name); + + /* Register the result value with the instrumentation system */ + toku_instr_file_close_end(io_annotation, result); + + return result; +} + +int toku_os_rename_with_source_location(const char *old_name, + const char *new_name, + const char *src_file, + uint src_line) { + int result; + + toku_io_instrumentation io_annotation; + toku_instr_file_name_io_begin(io_annotation, + *tokudb_file_data_key, + toku_instr_file_op::file_rename, + new_name, + 0, + src_file, + src_line); + + result = rename(old_name, new_name); + /* Regsiter the result value with the instrumentation system */ + toku_instr_file_io_end(io_annotation, 0); + + return result; +} + +void toku_os_full_write_with_source_location(int fd, + const void *buf, + size_t len, + const char *src_file, + uint src_line) { + const char *bp = (const char *)buf; + size_t bytes_written = len; + + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_write, + fd, + len, + src_file, + src_line); + while (len > 0) { ssize_t r; if (t_full_write) { @@ -205,14 +268,30 @@ toku_os_full_write (int fd, const void *buf, size_t len) { } } assert(len == 0); + + /* Register the result value with the instrumentaion system */ + toku_instr_file_io_end(io_annotation, bytes_written); } -int -toku_os_write (int fd, const void *buf, size_t len) { - const char *bp = (const char *) buf; +int toku_os_write_with_source_location(int fd, + const void *buf, + size_t len, + const char *src_file, + uint src_line) { + const char *bp = (const char *)buf; int result = 0; + ssize_t r; + + size_t bytes_written = len; + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_write, + fd, + len, + src_file, + src_line); + while (len > 0) { - ssize_t r; if (t_write) { r = t_write(fd, bp, len); } else { @@ -222,17 +301,33 @@ toku_os_write (int fd, const void *buf, size_t len) { result = errno; break; } - len -= r; - bp += r; + len -= r; + bp += r; } + /* Register the result value with the instrumentation system */ + toku_instr_file_io_end(io_annotation, bytes_written - len); + return result; } -void -toku_os_full_pwrite (int fd, const void *buf, size_t len, toku_off_t off) { - assert(0==((long long)buf)%512); - assert((len%512 == 0) && (off%512)==0); // to make pwrite work. - const char *bp = (const char *) buf; +void toku_os_full_pwrite_with_source_location(int fd, + const void *buf, + size_t len, + toku_off_t off, + const char *src_file, + uint src_line) { + assert(0 == ((long long)buf) % 512); + assert((len % 512 == 0) && (off % 512) == 0); // to make pwrite work. + const char *bp = (const char *)buf; + + size_t bytes_written = len; + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_write, + fd, + len, + src_file, + src_line); while (len > 0) { ssize_t r; if (t_full_pwrite) { @@ -250,71 +345,209 @@ toku_os_full_pwrite (int fd, const void *buf, size_t len, toku_off_t off) { } } assert(len == 0); -} -ssize_t -toku_os_pwrite (int fd, const void *buf, size_t len, toku_off_t off) { - assert(0==((long long)buf)%512); // these asserts are to ensure that direct I/O will work. - assert(0==len %512); - assert(0==off %512); - const char *bp = (const char *) buf; + /* Register the result value with the instrumentation system */ + toku_instr_file_io_end(io_annotation, bytes_written); +} + +ssize_t toku_os_pwrite_with_source_location(int fd, + const void *buf, + size_t len, + toku_off_t off, + const char *src_file, + uint src_line) { + assert(0 == + ((long long)buf) % + 512); // these asserts are to ensure that direct I/O will work. + assert(0 == len % 512); + assert(0 == off % 512); + const char *bp = (const char *)buf; ssize_t result = 0; + ssize_t r; + + size_t bytes_written = len; + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_write, + fd, + len, + src_file, + src_line); while (len > 0) { - ssize_t r; - if (t_pwrite) { - r = t_pwrite(fd, bp, len, off); - } else { - r = pwrite(fd, bp, len, off); - } + r = (t_pwrite) ? t_pwrite(fd, bp, len, off) : pwrite(fd, bp, len, off); + if (r < 0) { result = errno; break; } len -= r; - bp += r; - off += r; + bp += r; + off += r; + } + /* Register the result value with the instrumentation system */ + toku_instr_file_io_end(io_annotation, bytes_written - len); + + return result; +} + +int toku_os_fwrite_with_source_location(const void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + const char *src_file, + uint src_line) { + int result = 0; + size_t bytes_written; + + toku_io_instrumentation io_annotation; + toku_instr_file_stream_io_begin(io_annotation, + toku_instr_file_op::file_write, + *stream, + nmemb, + src_file, + src_line); + + if (os_fwrite_fun) { + bytes_written = os_fwrite_fun(ptr, size, nmemb, stream->file); + } else { + bytes_written = fwrite(ptr, size, nmemb, stream->file); + } + + if (bytes_written != nmemb) { + if (os_fwrite_fun) // if using hook to induce artificial errors (for + // testing) ... + result = get_maybe_error_errno(); // ... then there is no error in + // the stream, but there is one + // in errno + else + result = ferror(stream->file); + invariant(result != 0); // Should we assert here? + } + /* Register the result value with the instrumentation system */ + toku_instr_file_io_end(io_annotation, bytes_written); + + return result; +} + +int toku_os_fread_with_source_location(void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + const char *src_file, + uint src_line) { + int result = 0; + size_t bytes_read; + + toku_io_instrumentation io_annotation; + toku_instr_file_stream_io_begin(io_annotation, + toku_instr_file_op::file_read, + *stream, + nmemb, + src_file, + src_line); + + if ((bytes_read = fread(ptr, size, nmemb, stream->file)) != nmemb) { + if ((feof(stream->file))) + result = EOF; + else + result = ferror(stream->file); + invariant(result != 0); // Should we assert here? } + /* Register the result value with the instrumentation system */ + toku_instr_file_io_end(io_annotation, bytes_read); + return result; } -FILE * -toku_os_fdopen(int fildes, const char *mode) { - FILE * rval; - if (t_fdopen) - rval = t_fdopen(fildes, mode); - else - rval = fdopen(fildes, mode); +TOKU_FILE *toku_os_fdopen_with_source_location(int fildes, + const char *mode, + const char *filename, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line) { + TOKU_FILE *XMALLOC(rval); + if (FT_LIKELY(rval != nullptr)) { + toku_io_instrumentation io_annotation; + toku_instr_file_open_begin(io_annotation, + instr_key, + toku_instr_file_op::file_stream_open, + filename, + src_file, + src_line); + + rval->file = (t_fdopen) ? t_fdopen(fildes, mode) : fdopen(fildes, mode); + toku_instr_file_stream_open_end(io_annotation, *rval); + + if (FT_UNLIKELY(rval->file == nullptr)) { + toku_free(rval); + rval = nullptr; + } + } return rval; } - -FILE * -toku_os_fopen(const char *filename, const char *mode){ - FILE * rval; - if (t_fopen) - rval = t_fopen(filename, mode); - else - rval = fopen(filename, mode); +TOKU_FILE *toku_os_fopen_with_source_location(const char *filename, + const char *mode, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line) { + TOKU_FILE *XMALLOC(rval); + if (FT_UNLIKELY(rval == nullptr)) + return nullptr; + + toku_io_instrumentation io_annotation; + toku_instr_file_open_begin(io_annotation, + instr_key, + toku_instr_file_op::file_stream_open, + filename, + src_file, + src_line); + rval->file = t_fopen ? t_fopen(filename, mode) : fopen(filename, mode); + /* Register the returning "file" value with the system */ + toku_instr_file_stream_open_end(io_annotation, *rval); + + if (FT_UNLIKELY(rval->file == nullptr)) { + toku_free(rval); + rval = nullptr; + } return rval; } -int -toku_os_open(const char *path, int oflag, int mode) { - int rval; +int toku_os_open_with_source_location(const char *path, + int oflag, + int mode, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line) { + int fd; + toku_io_instrumentation io_annotation; + /* register a file open or creation depending on "oflag" */ + toku_instr_file_open_begin( + io_annotation, + instr_key, + ((oflag & O_CREAT) ? toku_instr_file_op::file_create + : toku_instr_file_op::file_open), + path, + src_file, + src_line); if (t_open) - rval = t_open(path, oflag, mode); + fd = t_open(path, oflag, mode); else - rval = open(path, oflag, mode); - return rval; + fd = open(path, oflag, mode); + + toku_instr_file_open_end(io_annotation, fd); + return fd; } -int -toku_os_open_direct(const char *path, int oflag, int mode) { +int toku_os_open_direct(const char *path, + int oflag, + int mode, + const toku_instr_key &instr_key) { int rval; #if defined(HAVE_O_DIRECT) - rval = toku_os_open(path, oflag | O_DIRECT, mode); + rval = toku_os_open(path, oflag | O_DIRECT, mode, instr_key); #elif defined(HAVE_F_NOCACHE) - rval = toku_os_open(path, oflag, mode); + rval = toku_os_open(path, oflag, mode, instr_key); if (rval >= 0) { int r = fcntl(rval, F_NOCACHE, 1); if (r == -1) { @@ -327,63 +560,112 @@ toku_os_open_direct(const char *path, int oflag, int mode) { return rval; } -int -toku_os_fclose(FILE * stream) { +int toku_os_fclose_with_source_location(TOKU_FILE *stream, + const char *src_file, + uint src_line) { int rval = -1; - if (t_fclose) - rval = t_fclose(stream); - else { // if EINTR, retry until success - while (rval != 0) { - rval = fclose(stream); - if (rval && (errno != EINTR)) - break; - } + if (FT_LIKELY(stream != nullptr)) { + /* register a file stream close " */ + toku_io_instrumentation io_annotation; + toku_instr_file_stream_close_begin( + io_annotation, + toku_instr_file_op::file_stream_close, + *stream, + src_file, + src_line); + + if (t_fclose) + rval = t_fclose(stream->file); + else { // if EINTR, retry until success + while (rval != 0) { + rval = fclose(stream->file); + if (rval && (errno != EINTR)) + break; + } + } + /* Register the returning "rval" value with the system */ + toku_instr_file_close_end(io_annotation, rval); + toku_free(stream); + stream = nullptr; } return rval; } -int -toku_os_close(int fd) { // if EINTR, retry until success +int toku_os_close_with_source_location( + int fd, + const char *src_file, + uint src_line) { // if EINTR, retry until success + /* register the file close */ int r = -1; + + /* register a file descriptor close " */ + toku_io_instrumentation io_annotation; + toku_instr_file_fd_close_begin( + io_annotation, toku_instr_file_op::file_close, fd, src_file, src_line); while (r != 0) { - r = close(fd); - if (r) { - int rr = errno; - if (rr!=EINTR) printf("rr=%d (%s)\n", rr, strerror(rr)); - assert(rr==EINTR); - } + r = close(fd); + if (r) { + int rr = errno; + if (rr != EINTR) + printf("rr=%d (%s)\n", rr, strerror(rr)); + assert(rr == EINTR); + } } - return r; -} - -int toku_os_rename(const char *old_name, const char *new_name) { - return rename(old_name, new_name); -} -int toku_os_unlink(const char *path) { return unlink(path); } + /* Regsiter the returning value with the system */ + toku_instr_file_close_end(io_annotation, r); -ssize_t -toku_os_read(int fd, void *buf, size_t count) { - ssize_t r; - if (t_read) - r = t_read(fd, buf, count); - else - r = read(fd, buf, count); return r; } -ssize_t -toku_os_pread (int fd, void *buf, size_t count, off_t offset) { - assert(0==((long long)buf)%512); - assert(0==count%512); - assert(0==offset%512); - ssize_t r; +ssize_t toku_os_read_with_source_location(int fd, + void *buf, + size_t count, + const char *src_file, + uint src_line) { + ssize_t bytes_read; + + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_read, + fd, + count, + src_file, + src_line); + + bytes_read = (t_read) ? t_read(fd, buf, count) : read(fd, buf, count); + + toku_instr_file_io_end(io_annotation, bytes_read); + + return bytes_read; +} + +ssize_t inline_toku_os_pread_with_source_location(int fd, + void *buf, + size_t count, + off_t offset, + const char *src_file, + uint src_line) { + assert(0 == ((long long)buf) % 512); + assert(0 == count % 512); + assert(0 == offset % 512); + ssize_t bytes_read; + + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_read, + fd, + count, + src_file, + src_line); if (t_pread) { - r = t_pread(fd, buf, count, offset); + bytes_read = t_pread(fd, buf, count, offset); } else { - r = pread(fd, buf, count, offset); + bytes_read = pread(fd, buf, count, offset); } - return r; + toku_instr_file_io_end(io_annotation, bytes_read); + + return bytes_read; } void toku_os_recursive_delete(const char *path) { @@ -411,13 +693,24 @@ void toku_set_func_fsync(int (*fsync_function)(int)) { } // keep trying if fsync fails because of EINTR -static void file_fsync_internal (int fd) { +void file_fsync_internal_with_source_location(int fd, + const char *src_file, + uint src_line) { uint64_t tstart = toku_current_time_microsec(); int r = -1; uint64_t eintr_count = 0; + + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_sync, + fd, + 0, + src_file, + src_line); + while (r != 0) { - if (t_fsync) { - r = t_fsync(fd); + if (t_fsync) { + r = t_fsync(fd); } else { r = fsync(fd); } @@ -429,6 +722,9 @@ static void file_fsync_internal (int fd) { toku_sync_fetch_and_add(&toku_fsync_count, 1); uint64_t duration = toku_current_time_microsec() - tstart; toku_sync_fetch_and_add(&toku_fsync_time, duration); + + toku_instr_file_io_end(io_annotation, 0); + if (duration >= toku_long_fsync_threshold) { toku_sync_fetch_and_add(&toku_long_fsync_count, 1); toku_sync_fetch_and_add(&toku_long_fsync_time, duration); diff --git a/storage/tokudb/PerconaFT/portability/memory.cc b/storage/tokudb/PerconaFT/portability/memory.cc index 5430ff84b70591903fffbf60b953126b30738d73..9594158cf3813b27ab3e4dfc8b65e5b8abaf12b0 100644 --- a/storage/tokudb/PerconaFT/portability/memory.cc +++ b/storage/tokudb/PerconaFT/portability/memory.cc @@ -104,7 +104,13 @@ toku_memory_startup(void) { size_t lg_chunk; // log2 of the mmap threshold size_t lg_chunk_length = sizeof lg_chunk; result = mallctl_f("opt.lg_chunk", &lg_chunk, &lg_chunk_length, NULL, 0); - if (result == 0) + if (result) + { + status.mmap_threshold = 1 << 21; // Default value. + // Incompatible jemalloc change. + result = 0; + } + else status.mmap_threshold = 1 << lg_chunk; } } diff --git a/storage/tokudb/PerconaFT/portability/portability.cc b/storage/tokudb/PerconaFT/portability/portability.cc index 19f445a85d7f4afaa97127fda96f80a5cc9015f8..dfa5153cc667ab0f4e511f6dfc731ed3e8068ddf 100644 --- a/storage/tokudb/PerconaFT/portability/portability.cc +++ b/storage/tokudb/PerconaFT/portability/portability.cc @@ -79,6 +79,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "toku_os.h" #include "toku_time.h" #include "memory.h" + +#include "toku_instrumentation.h" + #include #include @@ -172,13 +175,26 @@ toku_os_get_phys_memory_size(void) { #endif } -int -toku_os_get_file_size(int fildes, int64_t *fsize) { +int toku_os_get_file_size_with_source_location(int fildes, + int64_t *fsize, + const char *src_file, + uint src_line) { toku_struct_stat sbuf; + + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_stat, + fildes, + 0, + src_file, + src_line); + int r = fstat(fildes, &sbuf); - if (r==0) { + if (r == 0) { *fsize = sbuf.st_size; } + toku_instr_file_io_end(io_annotation, 0); + return r; } @@ -272,15 +288,39 @@ toku_os_get_max_process_data_size(uint64_t *maxdata) { return r; } -int -toku_stat(const char *name, toku_struct_stat *buf) { +int toku_stat_with_source_location(const char *name, + toku_struct_stat *buf, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line) { + toku_io_instrumentation io_annotation; + toku_instr_file_name_io_begin(io_annotation, + instr_key, + toku_instr_file_op::file_stat, + name, + 0, + src_file, + src_line); int r = stat(name, buf); + + toku_instr_file_io_end(io_annotation, 0); return r; } -int -toku_fstat(int fd, toku_struct_stat *buf) { +int toku_os_fstat_with_source_location(int fd, + toku_struct_stat *buf, + const char *src_file, + uint src_line) { + toku_io_instrumentation io_annotation; + toku_instr_file_io_begin(io_annotation, + toku_instr_file_op::file_stat, + fd, + 0, + src_file, + src_line); + int r = fstat(fd, buf); + toku_instr_file_io_end(io_annotation, 0); return r; } @@ -427,5 +467,9 @@ void __attribute__((constructor)) toku_portability_helgrind_ignore(void); void toku_portability_helgrind_ignore(void) { TOKU_VALGRIND_HG_DISABLE_CHECKING(&toku_cached_hz, sizeof toku_cached_hz); - TOKU_VALGRIND_HG_DISABLE_CHECKING(&toku_cached_pagesize, sizeof toku_cached_pagesize); + TOKU_VALGRIND_HG_DISABLE_CHECKING(&toku_cached_pagesize, + sizeof toku_cached_pagesize); } + +static const pfs_key_t pfs_not_instrumented = 0xFFFFFFFF; +toku_instr_key toku_uninstrumented(pfs_not_instrumented); diff --git a/storage/tokudb/PerconaFT/portability/tests/rwlock_condvar.h b/storage/tokudb/PerconaFT/portability/tests/rwlock_condvar.h index 92f2fb354f70eed8aece504fbfa1e212a5c98061..d1ebc81e1dc96dc93eaee15fae24bfc365920797 100644 --- a/storage/tokudb/PerconaFT/portability/tests/rwlock_condvar.h +++ b/storage/tokudb/PerconaFT/portability/tests/rwlock_condvar.h @@ -107,10 +107,10 @@ get_waitstate(void) #endif int toku_cv_fair_rwlock_init (toku_cv_fair_rwlock_t *rwlock) { - rwlock->state=0; + rwlock->state = 0; rwlock->waiters_head = NULL; rwlock->waiters_tail = NULL; - toku_mutex_init(&rwlock->mutex, NULL); + toku_mutex_init(toku_uninstrumented, &rwlock->mutex, nullptr); return 0; } diff --git a/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rdlock.cc b/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rdlock.cc index 364bd7d3766c22b147aabdf36002cb085d14e301..62aa5205f3c108df68a36f5ce197fee29ec07d21 100644 --- a/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rdlock.cc +++ b/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rdlock.cc @@ -48,7 +48,7 @@ int test_main(int argc __attribute__((__unused__)), char *const argv[] __attribu toku_pthread_rwlock_t rwlock; ZERO_STRUCT(rwlock); - toku_pthread_rwlock_init(&rwlock, NULL); + toku_pthread_rwlock_init(toku_uninstrumented, &rwlock, nullptr); toku_pthread_rwlock_rdlock(&rwlock); toku_pthread_rwlock_rdlock(&rwlock); toku_pthread_rwlock_rdunlock(&rwlock); diff --git a/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rwr.cc b/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rwr.cc index 3ca9e06bff75a4d04fda509597a91553b0a67dd8..92b30421ba9b44ef0df255acfd5a80dd9f646b17 100644 --- a/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rwr.cc +++ b/storage/tokudb/PerconaFT/portability/tests/test-pthread-rwlock-rwr.cc @@ -71,13 +71,19 @@ int test_main(int argc , char *const argv[] ) { toku_pthread_t tid; void *retptr; - toku_pthread_rwlock_init(&rwlock, NULL); - state = 37; if (verbose) printf("%s:%d\n", __FUNCTION__, __LINE__); + toku_pthread_rwlock_init(toku_uninstrumented, &rwlock, nullptr); + state = 37; + if (verbose) + printf("%s:%d\n", __FUNCTION__, __LINE__); toku_pthread_rwlock_rdlock(&rwlock); - r = toku_pthread_create(&tid, NULL, f, &rwlock); assert(r == 0); + r = toku_pthread_create(toku_uninstrumented, &tid, nullptr, f, &rwlock); + assert(r == 0); - assert(state==37); state = 42; if (verbose) printf("%s:%d\n", __FUNCTION__, __LINE__); + assert(state == 37); + state = 42; + if (verbose) + printf("%s:%d\n", __FUNCTION__, __LINE__); sleep(4); assert(state==16); state = 44; if (verbose) printf("%s:%d\n", __FUNCTION__, __LINE__); toku_pthread_rwlock_rdlock(&rwlock); diff --git a/storage/tokudb/PerconaFT/portability/tests/test-stat.cc b/storage/tokudb/PerconaFT/portability/tests/test-stat.cc index 494a17bd0742b03bc664092cd78b66f1f4f206f0..57201764afb899bee461d826c74b6d509316efaf 100644 --- a/storage/tokudb/PerconaFT/portability/tests/test-stat.cc +++ b/storage/tokudb/PerconaFT/portability/tests/test-stat.cc @@ -47,10 +47,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. static void test_stat(const char *dirname, int result, int ex_errno) { int r; toku_struct_stat buf; - r = toku_stat(dirname, &buf); - //printf("stat %s %d %d\n", dirname, r, errno); fflush(stdout); - assert(r==result); - if (r!=0) assert(get_maybe_error_errno() == ex_errno); + r = toku_stat(dirname, &buf, toku_uninstrumented); + // printf("stat %s %d %d\n", dirname, r, errno); fflush(stdout); + assert(r == result); + if (r != 0) + assert(get_maybe_error_errno() == ex_errno); } int main(void) { diff --git a/storage/tokudb/PerconaFT/portability/tests/test-toku-malloc.cc b/storage/tokudb/PerconaFT/portability/tests/test-toku-malloc.cc index 1e1c7533c15e77a61ececccff0730db8be4b7053..0d99b36b51a48f6473137f77b6dbaa479579839e 100644 --- a/storage/tokudb/PerconaFT/portability/tests/test-toku-malloc.cc +++ b/storage/tokudb/PerconaFT/portability/tests/test-toku-malloc.cc @@ -53,10 +53,12 @@ int main(void) { int i; const int max_threads = 2; toku_pthread_t tids[max_threads]; - for (i=0; i= 5) && (MYSQL_VERSION_MINOR >= 7) + return PSI_THREAD_CALL(spawn_thread)( + key.id(), reinterpret_cast(thread), + attr, start_routine, arg); +#else + return PSI_THREAD_CALL(spawn_thread)( + key.id(), thread, attr, start_routine, arg); +#endif +} + +void toku_instr_register_current_thread(const toku_instr_key &key) { + struct PSI_thread *psi_thread = + PSI_THREAD_CALL(new_thread)(key.id(), nullptr, 0); + PSI_THREAD_CALL(set_thread)(psi_thread); +} + +void toku_instr_delete_current_thread() { + PSI_THREAD_CALL(delete_current_thread)(); +} + +// I/O instrumentation + +void toku_instr_file_open_begin(toku_io_instrumentation &io_instr, + const toku_instr_key &key, + toku_instr_file_op op, + const char *name, + const char *src_file, + int src_line) { + io_instr.locker = + PSI_FILE_CALL(get_thread_file_name_locker)( + &io_instr.state, key.id(), static_cast(op), + name, io_instr.locker); + if (io_instr.locker != nullptr) { + PSI_FILE_CALL(start_file_open_wait) + (io_instr.locker, src_file, src_line); + } +} + +void toku_instr_file_stream_open_end(toku_io_instrumentation &io_instr, + TOKU_FILE &file) { + file.key = nullptr; + if (FT_LIKELY(io_instr.locker)) { + file.key = + PSI_FILE_CALL(end_file_open_wait)(io_instr.locker, file.file); + } +} + +void toku_instr_file_open_end(toku_io_instrumentation &io_instr, int fd) { + if (FT_LIKELY(io_instr.locker)) + PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor) + (io_instr.locker, fd); +} + +void toku_instr_file_name_close_begin(toku_io_instrumentation &io_instr, + const toku_instr_key &key, + toku_instr_file_op op, + const char *name, + const char *src_file, + int src_line) { + io_instr.locker = + PSI_FILE_CALL(get_thread_file_name_locker)( + &io_instr.state, key.id(), static_cast(op), + name, + io_instr.locker); + if (FT_LIKELY(io_instr.locker)) { + PSI_FILE_CALL(start_file_close_wait) + (io_instr.locker, src_file, src_line); + } +} + +void toku_instr_file_stream_close_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + const TOKU_FILE &file, + const char *src_file, + int src_line) { + io_instr.locker = nullptr; + if (FT_LIKELY(file.key)) { + io_instr.locker = PSI_FILE_CALL(get_thread_file_stream_locker)( + &io_instr.state, file.key, (PSI_file_operation)op); + if (FT_LIKELY(io_instr.locker)) { + PSI_FILE_CALL(start_file_close_wait) + (io_instr.locker, src_file, src_line); + } + } +} + +void toku_instr_file_fd_close_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + int fd, + const char *src_file, + int src_line) { + io_instr.locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)( + &io_instr.state, fd, (PSI_file_operation)op); + if (FT_LIKELY(io_instr.locker)) { + PSI_FILE_CALL(start_file_close_wait) + (io_instr.locker, src_file, src_line); + } +} + +void toku_instr_file_close_end(const toku_io_instrumentation &io_instr, + int result) { + if (FT_LIKELY(io_instr.locker)) + PSI_FILE_CALL(end_file_close_wait) + (io_instr.locker, result); +} + +void toku_instr_file_io_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + int fd, + ssize_t count, + const char *src_file, + int src_line) { + io_instr.locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)( + &io_instr.state, fd, (PSI_file_operation)op); + if (FT_LIKELY(io_instr.locker)) { + PSI_FILE_CALL(start_file_wait) + (io_instr.locker, count, src_file, src_line); + } +} + +void toku_instr_file_name_io_begin(toku_io_instrumentation &io_instr, + const toku_instr_key &key, + toku_instr_file_op op, + const char *name, + ssize_t count, + const char *src_file, + int src_line) { + io_instr.locker = + PSI_FILE_CALL(get_thread_file_name_locker)(&io_instr.state, + key.id(), + (PSI_file_operation)op, + name, + &io_instr.locker); + if (FT_LIKELY(io_instr.locker)) { + PSI_FILE_CALL(start_file_wait) + (io_instr.locker, count, src_file, src_line); + } +} + +void toku_instr_file_stream_io_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + const TOKU_FILE &file, + ssize_t count, + const char *src_file, + int src_line) { + io_instr.locker = nullptr; + if (FT_LIKELY(file.key)) { + io_instr.locker = PSI_FILE_CALL(get_thread_file_stream_locker)( + &io_instr.state, file.key, (PSI_file_operation)op); + if (FT_LIKELY(io_instr.locker)) { + PSI_FILE_CALL(start_file_wait) + (io_instr.locker, count, src_file, src_line); + } + } +} + +void toku_instr_file_io_end(toku_io_instrumentation &io_instr, ssize_t count) { + if (FT_LIKELY(io_instr.locker)) + PSI_FILE_CALL(end_file_wait) + (io_instr.locker, count); +} + +// Mutex instrumentation + +void toku_instr_mutex_init(const toku_instr_key &key, toku_mutex_t &mutex) { + mutex.psi_mutex = PSI_MUTEX_CALL(init_mutex)(key.id(), &mutex.pmutex); +#if TOKU_PTHREAD_DEBUG + mutex.instr_key_id = key.id(); +#endif +} + +void toku_instr_mutex_destroy(PSI_mutex *&mutex_instr) { + if (mutex_instr != nullptr) { + PSI_MUTEX_CALL(destroy_mutex)(mutex_instr); + mutex_instr = nullptr; + } +} + +void toku_instr_mutex_lock_start(toku_mutex_instrumentation &mutex_instr, + toku_mutex_t &mutex, + const char *src_file, + int src_line) { + mutex_instr.locker = nullptr; + if (mutex.psi_mutex) { + mutex_instr.locker = + PSI_MUTEX_CALL(start_mutex_wait)(&mutex_instr.state, + mutex.psi_mutex, + PSI_MUTEX_LOCK, + src_file, + src_line); + } +} + +void toku_instr_mutex_trylock_start(toku_mutex_instrumentation &mutex_instr, + toku_mutex_t &mutex, + const char *src_file, + int src_line) { + mutex_instr.locker = nullptr; + if (mutex.psi_mutex) { + mutex_instr.locker = + PSI_MUTEX_CALL(start_mutex_wait)(&mutex_instr.state, + mutex.psi_mutex, + PSI_MUTEX_TRYLOCK, + src_file, + src_line); + } +} + +void toku_instr_mutex_lock_end(toku_mutex_instrumentation &mutex_instr, + int pthread_mutex_lock_result) { + if (mutex_instr.locker) + PSI_MUTEX_CALL(end_mutex_wait) + (mutex_instr.locker, pthread_mutex_lock_result); +} + +void toku_instr_mutex_unlock(PSI_mutex *mutex_instr) { + if (mutex_instr) + PSI_MUTEX_CALL(unlock_mutex)(mutex_instr); +} + +// Condvar instrumentation + +void toku_instr_cond_init(const toku_instr_key &key, toku_cond_t &cond) { + cond.psi_cond = PSI_COND_CALL(init_cond)(key.id(), &cond.pcond); +#if TOKU_PTHREAD_DEBUG + cond.instr_key_id = key.id(); +#endif +} + +void toku_instr_cond_destroy(PSI_cond *&cond_instr) { + if (cond_instr != nullptr) { + PSI_COND_CALL(destroy_cond)(cond_instr); + cond_instr = nullptr; + } +} + +void toku_instr_cond_wait_start(toku_cond_instrumentation &cond_instr, + toku_instr_cond_op op, + toku_cond_t &cond, + toku_mutex_t &mutex, + const char *src_file, + int src_line) { + cond_instr.locker = nullptr; + if (cond.psi_cond) { + /* Instrumentation start */ + cond_instr.locker = + PSI_COND_CALL(start_cond_wait)(&cond_instr.state, + cond.psi_cond, + mutex.psi_mutex, + (PSI_cond_operation)op, + src_file, + src_line); + } +} + +void toku_instr_cond_wait_end(toku_cond_instrumentation &cond_instr, + int pthread_cond_wait_result) { + if (cond_instr.locker) + PSI_COND_CALL(end_cond_wait) + (cond_instr.locker, pthread_cond_wait_result); +} + +void toku_instr_cond_signal(const toku_cond_t &cond) { + if (cond.psi_cond) + PSI_COND_CALL(signal_cond)(cond.psi_cond); +} + +void toku_instr_cond_broadcast(const toku_cond_t &cond) { + if (cond.psi_cond) + PSI_COND_CALL(broadcast_cond)(cond.psi_cond); +} + +// rwlock instrumentation + +void toku_instr_rwlock_init(const toku_instr_key &key, + toku_pthread_rwlock_t &rwlock) { + rwlock.psi_rwlock = PSI_RWLOCK_CALL(init_rwlock)(key.id(), &rwlock.rwlock); +#if TOKU_PTHREAD_DEBUG + rwlock.instr_key_id = key.id(); +#endif +} + +void toku_instr_rwlock_destroy(PSI_rwlock *&rwlock_instr) { + if (rwlock_instr != nullptr) { + PSI_RWLOCK_CALL(destroy_rwlock)(rwlock_instr); + rwlock_instr = nullptr; + } +} + +void toku_instr_rwlock_rdlock_wait_start( + toku_rwlock_instrumentation &rwlock_instr, + toku_pthread_rwlock_t &rwlock, + const char *src_file, + int src_line) { + rwlock_instr.locker = nullptr; + if (rwlock.psi_rwlock) { + /* Instrumentation start */ + rwlock_instr.locker = + PSI_RWLOCK_CALL(start_rwlock_rdwait)(&rwlock_instr.state, + rwlock.psi_rwlock, + PSI_RWLOCK_READLOCK, + src_file, + src_line); + } +} + +void toku_instr_rwlock_wrlock_wait_start( + toku_rwlock_instrumentation &rwlock_instr, + toku_pthread_rwlock_t &rwlock, + const char *src_file, + int src_line) { + rwlock_instr.locker = nullptr; + if (rwlock.psi_rwlock) { + /* Instrumentation start */ + rwlock_instr.locker = + PSI_RWLOCK_CALL(start_rwlock_wrwait)(&rwlock_instr.state, + rwlock.psi_rwlock, + PSI_RWLOCK_WRITELOCK, + src_file, + src_line); + } +} + +void toku_instr_rwlock_rdlock_wait_end( + toku_rwlock_instrumentation &rwlock_instr, + int pthread_rwlock_wait_result) { + if (rwlock_instr.locker) + PSI_RWLOCK_CALL(end_rwlock_rdwait) + (rwlock_instr.locker, pthread_rwlock_wait_result); +} + +void toku_instr_rwlock_wrlock_wait_end( + toku_rwlock_instrumentation &rwlock_instr, + int pthread_rwlock_wait_result) { + if (rwlock_instr.locker) + PSI_RWLOCK_CALL(end_rwlock_wrwait) + (rwlock_instr.locker, pthread_rwlock_wait_result); +} + +void toku_instr_rwlock_unlock(toku_pthread_rwlock_t &rwlock) { + if (rwlock.psi_rwlock) + PSI_RWLOCK_CALL(unlock_rwlock)(rwlock.psi_rwlock); +} + +#endif // MYSQL_TOKUDB_ENGINE diff --git a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h new file mode 100644 index 0000000000000000000000000000000000000000..d6b0ed35ce97f69d8f2564c4885bfd683d8416f4 --- /dev/null +++ b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h @@ -0,0 +1,249 @@ +#ifdef TOKU_INSTR_MYSQL_H +// This file can be included only from toku_instumentation.h because +// it replaces the defintitions for the case if MySQL PFS is available +#error "toku_instr_mysql.h can be included only once" +#else // TOKU_INSTR_MYSQL_H +#define TOKU_INSTR_MYSQL_H + +#include + +// As these macros are defined in my_global.h +// and they are also defined in command line +// undefine them here to avoid compilation errors. +#undef __STDC_FORMAT_MACROS +#undef __STDC_LIMIT_MACROS +#include // PSI_file +#include // PSI_mutex + +#ifndef HAVE_PSI_MUTEX_INTERFACE +#error HAVE_PSI_MUTEX_INTERFACE required +#endif +#ifndef HAVE_PSI_RWLOCK_INTERFACE +#error HAVE_PSI_RWLOCK_INTERFACE required +#endif +#ifndef HAVE_PSI_THREAD_INTERFACE +#error HAVE_PSI_THREAD_INTERFACE required +#endif + +// Instrumentation keys + +class toku_instr_key { + private: + pfs_key_t m_id; + + public: + toku_instr_key(toku_instr_object_type type, + const char *group, + const char *name) { + switch (type) { + case toku_instr_object_type::mutex: { + PSI_mutex_info mutex_info{&m_id, name, 0}; + mysql_mutex_register(group, &mutex_info, 1); + } break; + case toku_instr_object_type::rwlock: { + PSI_rwlock_info rwlock_info{&m_id, name, 0}; + mysql_rwlock_register(group, &rwlock_info, 1); + } break; + case toku_instr_object_type::cond: { + PSI_cond_info cond_info{&m_id, name, 0}; + mysql_cond_register(group, &cond_info, 1); + } break; + case toku_instr_object_type::thread: { + PSI_thread_info thread_info{&m_id, name, 0}; + mysql_thread_register(group, &thread_info, 1); + } break; + case toku_instr_object_type::file: { + PSI_file_info file_info{&m_id, name, 0}; + mysql_file_register(group, &file_info, 1); + } break; + } + } + + explicit toku_instr_key(pfs_key_t key_id) : m_id(key_id) {} + + pfs_key_t id() const { return m_id; } +}; + +// Thread instrumentation +int toku_pthread_create(const toku_instr_key &key, + pthread_t *thread, + const pthread_attr_t *attr, + void *(*start_routine)(void *), + void *arg); +void toku_instr_register_current_thread(const toku_instr_key &key); +void toku_instr_delete_current_thread(); + +// I/O instrumentation + +enum class toku_instr_file_op { + file_stream_open = PSI_FILE_STREAM_OPEN, + file_create = PSI_FILE_CREATE, + file_open = PSI_FILE_OPEN, + file_delete = PSI_FILE_DELETE, + file_rename = PSI_FILE_RENAME, + file_read = PSI_FILE_READ, + file_write = PSI_FILE_WRITE, + file_sync = PSI_FILE_SYNC, + file_stream_close = PSI_FILE_STREAM_CLOSE, + file_close = PSI_FILE_CLOSE, + file_stat = PSI_FILE_STAT +}; + +struct toku_io_instrumentation { + struct PSI_file_locker *locker; + PSI_file_locker_state state; + + toku_io_instrumentation() : locker(nullptr) {} +}; + +void toku_instr_file_open_begin(toku_io_instrumentation &io_instr, + const toku_instr_key &key, + toku_instr_file_op op, + const char *name, + const char *src_file, + int src_line); +void toku_instr_file_stream_open_end(toku_io_instrumentation &io_instr, + TOKU_FILE &file); +void toku_instr_file_open_end(toku_io_instrumentation &io_instr, int fd); +void toku_instr_file_name_close_begin(toku_io_instrumentation &io_instr, + const toku_instr_key &key, + toku_instr_file_op op, + const char *name, + const char *src_file, + int src_line); +void toku_instr_file_stream_close_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + const TOKU_FILE &file, + const char *src_file, + int src_line); +void toku_instr_file_fd_close_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + int fd, + const char *src_file, + int src_line); +void toku_instr_file_close_end(const toku_io_instrumentation &io_instr, + int result); +void toku_instr_file_io_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + int fd, + ssize_t count, + const char *src_file, + int src_line); +void toku_instr_file_name_io_begin(toku_io_instrumentation &io_instr, + const toku_instr_key &key, + toku_instr_file_op op, + const char *name, + ssize_t count, + const char *src_file, + int src_line); +void toku_instr_file_stream_io_begin(toku_io_instrumentation &io_instr, + toku_instr_file_op op, + const TOKU_FILE &file, + ssize_t count, + const char *src_file, + int src_line); +void toku_instr_file_io_end(toku_io_instrumentation &io_instr, ssize_t count); + +// Mutex instrumentation + +struct toku_mutex_instrumentation { + struct PSI_mutex_locker *locker; + PSI_mutex_locker_state state; + + toku_mutex_instrumentation() : locker(nullptr) {} +}; + +void toku_instr_mutex_init(const toku_instr_key &key, toku_mutex_t &mutex); +void toku_instr_mutex_destroy(PSI_mutex *&mutex_instr); +void toku_instr_mutex_lock_start(toku_mutex_instrumentation &mutex_instr, + toku_mutex_t &mutex, + const char *src_file, + int src_line); +void toku_instr_mutex_trylock_start(toku_mutex_instrumentation &mutex_instr, + toku_mutex_t &mutex, + const char *src_file, + int src_line); +void toku_instr_mutex_lock_end(toku_mutex_instrumentation &mutex_instr, + int pthread_mutex_lock_result); +void toku_instr_mutex_unlock(PSI_mutex *mutex_instr); + +// Instrumentation probes + +class toku_instr_probe_pfs { + private: + std::unique_ptr mutex; + toku_mutex_instrumentation mutex_instr; + + public: + explicit toku_instr_probe_pfs(const toku_instr_key &key); + + ~toku_instr_probe_pfs(); + + void start_with_source_location(const char *src_file, int src_line) { + mutex_instr.locker = nullptr; + toku_instr_mutex_lock_start(mutex_instr, *mutex, src_file, src_line); + } + + void stop() { toku_instr_mutex_lock_end(mutex_instr, 0); } +}; + +typedef toku_instr_probe_pfs toku_instr_probe; + +// Condvar instrumentation + +struct toku_cond_instrumentation { + struct PSI_cond_locker *locker; + PSI_cond_locker_state state; + + toku_cond_instrumentation() : locker(nullptr) {} +}; + +enum class toku_instr_cond_op { + cond_wait = PSI_COND_WAIT, + cond_timedwait = PSI_COND_TIMEDWAIT, +}; + +void toku_instr_cond_init(const toku_instr_key &key, toku_cond_t &cond); +void toku_instr_cond_destroy(PSI_cond *&cond_instr); +void toku_instr_cond_wait_start(toku_cond_instrumentation &cond_instr, + toku_instr_cond_op op, + toku_cond_t &cond, + toku_mutex_t &mutex, + const char *src_file, + int src_line); +void toku_instr_cond_wait_end(toku_cond_instrumentation &cond_instr, + int pthread_cond_wait_result); +void toku_instr_cond_signal(const toku_cond_t &cond); +void toku_instr_cond_broadcast(const toku_cond_t &cond); + +// rwlock instrumentation + +struct toku_rwlock_instrumentation { + struct PSI_rwlock_locker *locker; + PSI_rwlock_locker_state state; + + toku_rwlock_instrumentation() : locker(nullptr) { } +}; + +void toku_instr_rwlock_init(const toku_instr_key &key, + toku_pthread_rwlock_t &rwlock); +void toku_instr_rwlock_destroy(PSI_rwlock *&rwlock_instr); +void toku_instr_rwlock_rdlock_wait_start( + toku_rwlock_instrumentation &rwlock_instr, + toku_pthread_rwlock_t &rwlock, + const char *src_file, + int src_line); +void toku_instr_rwlock_wrlock_wait_start( + toku_rwlock_instrumentation &rwlock_instr, + toku_pthread_rwlock_t &rwlock, + const char *src_file, + int src_line); +void toku_instr_rwlock_rdlock_wait_end( + toku_rwlock_instrumentation &rwlock_instr, + int pthread_rwlock_wait_result); +void toku_instr_rwlock_wrlock_wait_end( + toku_rwlock_instrumentation &rwlock_instr, + int pthread_rwlock_wait_result); +void toku_instr_rwlock_unlock(toku_pthread_rwlock_t &rwlock); + +#endif // TOKU_INSTR_MYSQL_H diff --git a/storage/tokudb/PerconaFT/portability/toku_instrumentation.h b/storage/tokudb/PerconaFT/portability/toku_instrumentation.h new file mode 100644 index 0000000000000000000000000000000000000000..8c9390edc0a32bcbab2d56177e1f3cc6af3aa848 --- /dev/null +++ b/storage/tokudb/PerconaFT/portability/toku_instrumentation.h @@ -0,0 +1,339 @@ +#pragma once + +#include // FILE + +// Performance instrumentation object identifier type +typedef unsigned int pfs_key_t; + +enum class toku_instr_object_type { mutex, rwlock, cond, thread, file }; + +struct PSI_file; + +struct TOKU_FILE { + /** The real file. */ + FILE *file; + struct PSI_file *key; + TOKU_FILE() : file(nullptr), key(nullptr) {} +}; + +struct PSI_mutex; +struct PSI_cond; +struct PSI_rwlock; + +struct toku_mutex_t; +struct toku_cond_t; +struct toku_pthread_rwlock_t; + +class toku_instr_key; + +class toku_instr_probe_empty { + public: + explicit toku_instr_probe_empty(UU(const toku_instr_key &key)) {} + + void start_with_source_location(UU(const char *src_file), + UU(int src_line)) {} + + void stop() {} +}; + +#define TOKU_PROBE_START(p) p->start_with_source_location(__FILE__, __LINE__) +#define TOKU_PROBE_STOP(p) p->stop + +extern toku_instr_key toku_uninstrumented; + +#ifndef MYSQL_TOKUDB_ENGINE + +#include + +class toku_instr_key { + public: + toku_instr_key(UU(toku_instr_object_type type), + UU(const char *group), + UU(const char *name)) {} + + explicit toku_instr_key(UU(pfs_key_t key_id)) {} +}; + +typedef toku_instr_probe_empty toku_instr_probe; + +enum class toku_instr_file_op { + file_stream_open, + file_create, + file_open, + file_delete, + file_rename, + file_read, + file_write, + file_sync, + file_stream_close, + file_close, + file_stat +}; + +struct PSI_file {}; +struct PSI_mutex {}; + +struct toku_io_instrumentation {}; + +inline int toku_pthread_create(UU(const toku_instr_key &key), + pthread_t *thread, + const pthread_attr_t *attr, + void *(*start_routine)(void *), + void *arg) { + return pthread_create(thread, attr, start_routine, arg); +} + +inline void toku_instr_register_current_thread() {} + +inline void toku_instr_delete_current_thread() {} + +// Instrument file creation, opening, closing, and renaming +inline void toku_instr_file_open_begin(UU(toku_io_instrumentation &io_instr), + UU(const toku_instr_key &key), + UU(toku_instr_file_op op), + UU(const char *name), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_stream_open_end( + UU(toku_io_instrumentation &io_instr), + UU(TOKU_FILE &file)) {} + +inline void toku_instr_file_open_end(UU(toku_io_instrumentation &io_instr), + UU(int fd)) {} + +inline void toku_instr_file_name_close_begin( + UU(toku_io_instrumentation &io_instr), + UU(const toku_instr_key &key), + UU(toku_instr_file_op op), + UU(const char *name), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_stream_close_begin( + UU(toku_io_instrumentation &io_instr), + UU(toku_instr_file_op op), + UU(TOKU_FILE &file), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_fd_close_begin( + UU(toku_io_instrumentation &io_instr), + UU(toku_instr_file_op op), + UU(int fd), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_close_end(UU(toku_io_instrumentation &io_instr), + UU(int result)) {} + +inline void toku_instr_file_io_begin(UU(toku_io_instrumentation &io_instr), + UU(toku_instr_file_op op), + UU(int fd), + UU(unsigned int count), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_name_io_begin(UU(toku_io_instrumentation &io_instr), + UU(const toku_instr_key &key), + UU(toku_instr_file_op op), + UU(const char *name), + UU(unsigned int count), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_stream_io_begin( + UU(toku_io_instrumentation &io_instr), + UU(toku_instr_file_op op), + UU(TOKU_FILE &file), + UU(unsigned int count), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_file_io_end(UU(toku_io_instrumentation &io_instr), + UU(unsigned int count)) {} + +struct toku_mutex_t; + +struct toku_mutex_instrumentation {}; + +inline PSI_mutex *toku_instr_mutex_init(UU(const toku_instr_key &key), + UU(toku_mutex_t &mutex)) { + return nullptr; +} + +inline void toku_instr_mutex_destroy(UU(PSI_mutex *&mutex_instr)) {} + +inline void toku_instr_mutex_lock_start( + UU(toku_mutex_instrumentation &mutex_instr), + UU(toku_mutex_t &mutex), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_mutex_trylock_start( + UU(toku_mutex_instrumentation &mutex_instr), + UU(toku_mutex_t &mutex), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_mutex_lock_end( + UU(toku_mutex_instrumentation &mutex_instr), + UU(int pthread_mutex_lock_result)) {} + +inline void toku_instr_mutex_unlock(UU(PSI_mutex *mutex_instr)) {} + +struct toku_cond_instrumentation {}; + +enum class toku_instr_cond_op { + cond_wait, + cond_timedwait, +}; + +inline PSI_cond *toku_instr_cond_init(UU(const toku_instr_key &key), + UU(toku_cond_t &cond)) { + return nullptr; +} + +inline void toku_instr_cond_destroy(UU(PSI_cond *&cond_instr)) {} + +inline void toku_instr_cond_wait_start( + UU(toku_cond_instrumentation &cond_instr), + UU(toku_instr_cond_op op), + UU(toku_cond_t &cond), + UU(toku_mutex_t &mutex), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_cond_wait_end(UU(toku_cond_instrumentation &cond_instr), + UU(int pthread_cond_wait_result)) {} + +inline void toku_instr_cond_signal(UU(toku_cond_t &cond)) {} + +inline void toku_instr_cond_broadcast(UU(toku_cond_t &cond)) {} + +// rwlock instrumentation +struct toku_rwlock_instrumentation {}; + +inline PSI_rwlock *toku_instr_rwlock_init(UU(const toku_instr_key &key), + UU(toku_pthread_rwlock_t &rwlock)) { + return nullptr; +} + +inline void toku_instr_rwlock_destroy(UU(PSI_rwlock *&rwlock_instr)) {} + +inline void toku_instr_rwlock_rdlock_wait_start( + UU(toku_rwlock_instrumentation &rwlock_instr), + UU(toku_pthread_rwlock_t &rwlock), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_rwlock_wrlock_wait_start( + UU(toku_rwlock_instrumentation &rwlock_instr), + UU(toku_pthread_rwlock_t &rwlock), + UU(const char *src_file), + UU(int src_line)) {} + +inline void toku_instr_rwlock_rdlock_wait_end( + UU(toku_rwlock_instrumentation &rwlock_instr), + UU(int pthread_rwlock_wait_result)) {} + +inline void toku_instr_rwlock_wrlock_wait_end( + UU(toku_rwlock_instrumentation &rwlock_instr), + UU(int pthread_rwlock_wait_result)) {} + +inline void toku_instr_rwlock_unlock(UU(toku_pthread_rwlock_t &rwlock)) {} + +#else // MYSQL_TOKUDB_ENGINE +// There can be not only mysql but also mongodb or any other PFS stuff +#include +#endif // MYSQL_TOKUDB_ENGINE + +extern toku_instr_key toku_uninstrumented; + +extern toku_instr_probe *toku_instr_probe_1; + +// threads +extern toku_instr_key *extractor_thread_key; +extern toku_instr_key *fractal_thread_key; +extern toku_instr_key *io_thread_key; +extern toku_instr_key *eviction_thread_key; +extern toku_instr_key *kibbutz_thread_key; +extern toku_instr_key *minicron_thread_key; +extern toku_instr_key *tp_internal_thread_key; + +// Files +extern toku_instr_key *tokudb_file_data_key; +extern toku_instr_key *tokudb_file_load_key; +extern toku_instr_key *tokudb_file_tmp_key; +extern toku_instr_key *tokudb_file_log_key; + +// Mutexes +extern toku_instr_key *kibbutz_mutex_key; +extern toku_instr_key *minicron_p_mutex_key; +extern toku_instr_key *queue_result_mutex_key; +extern toku_instr_key *tpool_lock_mutex_key; +extern toku_instr_key *workset_lock_mutex_key; +extern toku_instr_key *bjm_jobs_lock_mutex_key; +extern toku_instr_key *log_internal_lock_mutex_key; +extern toku_instr_key *cachetable_ev_thread_lock_mutex_key; +extern toku_instr_key *cachetable_disk_nb_mutex_key; +extern toku_instr_key *cachetable_m_mutex_key; +extern toku_instr_key *safe_file_size_lock_mutex_key; +extern toku_instr_key *checkpoint_safe_mutex_key; +extern toku_instr_key *ft_ref_lock_mutex_key; +extern toku_instr_key *loader_error_mutex_key; +extern toku_instr_key *bfs_mutex_key; +extern toku_instr_key *loader_bl_mutex_key; +extern toku_instr_key *loader_fi_lock_mutex_key; +extern toku_instr_key *loader_out_mutex_key; +extern toku_instr_key *result_output_condition_lock_mutex_key; +extern toku_instr_key *block_table_mutex_key; +extern toku_instr_key *rollback_log_node_cache_mutex_key; +extern toku_instr_key *txn_lock_mutex_key; +extern toku_instr_key *txn_state_lock_mutex_key; +extern toku_instr_key *txn_child_manager_mutex_key; +extern toku_instr_key *txn_manager_lock_mutex_key; +extern toku_instr_key *treenode_mutex_key; +extern toku_instr_key *manager_mutex_key; +extern toku_instr_key *manager_escalation_mutex_key; +extern toku_instr_key *manager_escalator_mutex_key; +extern toku_instr_key *db_txn_struct_i_txn_mutex_key; +extern toku_instr_key *indexer_i_indexer_lock_mutex_key; +extern toku_instr_key *indexer_i_indexer_estimate_lock_mutex_key; +extern toku_instr_key *locktree_request_info_mutex_key; +extern toku_instr_key *locktree_request_info_retry_mutex_key; + +// condition vars +extern toku_instr_key *result_state_cond_key; +extern toku_instr_key *bjm_jobs_wait_key; +extern toku_instr_key *cachetable_p_refcount_wait_key; +extern toku_instr_key *cachetable_m_flow_control_cond_key; +extern toku_instr_key *cachetable_m_ev_thread_cond_key; +extern toku_instr_key *bfs_cond_key; +extern toku_instr_key *result_output_condition_key; +extern toku_instr_key *manager_m_escalator_done_key; +extern toku_instr_key *lock_request_m_wait_cond_key; +extern toku_instr_key *queue_result_cond_key; +extern toku_instr_key *ws_worker_wait_key; +extern toku_instr_key *rwlock_wait_read_key; +extern toku_instr_key *rwlock_wait_write_key; +extern toku_instr_key *rwlock_cond_key; +extern toku_instr_key *tp_thread_wait_key; +extern toku_instr_key *tp_pool_wait_free_key; +extern toku_instr_key *frwlock_m_wait_read_key; +extern toku_instr_key *kibbutz_k_cond_key; +extern toku_instr_key *minicron_p_condvar_key; +extern toku_instr_key *locktree_request_info_retry_cv_key; + +// rwlocks +extern toku_instr_key *multi_operation_lock_key; +extern toku_instr_key *low_priority_multi_operation_lock_key; +extern toku_instr_key *cachetable_m_list_lock_key; +extern toku_instr_key *cachetable_m_pending_lock_expensive_key; +extern toku_instr_key *cachetable_m_pending_lock_cheap_key; +extern toku_instr_key *cachetable_m_lock_key; +extern toku_instr_key *result_i_open_dbs_rwlock_key; +extern toku_instr_key *checkpoint_safe_rwlock_key; +extern toku_instr_key *cachetable_value_key; +extern toku_instr_key *safe_file_size_lock_rwlock_key; +extern toku_instr_key *cachetable_disk_nb_rwlock_key; diff --git a/storage/tokudb/PerconaFT/portability/toku_os.h b/storage/tokudb/PerconaFT/portability/toku_os.h index 3a0e7376971dc5c439132fa607521ec17932aa9c..d7cfcfefb9aae2b69716d36edc61001a4c7e7223 100644 --- a/storage/tokudb/PerconaFT/portability/toku_os.h +++ b/storage/tokudb/PerconaFT/portability/toku_os.h @@ -116,12 +116,10 @@ int toku_fsync_dir_by_name_without_accounting(const char *dir_name); // *free_size is set to the bytes of free space in the file system // *total_size is set to the total bytes in the file system // Return 0 on success, otherwise an error number -int toku_get_filesystem_sizes(const char *path, uint64_t *avail_size, uint64_t *free_size, uint64_t *total_size); - -// Portable linux 'stat' -int toku_stat(const char *name, toku_struct_stat *statbuf) __attribute__((__visibility__("default"))); -// Portable linux 'fstat' -int toku_fstat(int fd, toku_struct_stat *statbuf) __attribute__((__visibility__("default"))); +int toku_get_filesystem_sizes(const char *path, + uint64_t *avail_size, + uint64_t *free_size, + uint64_t *total_size); // Portable linux 'dup2' int toku_dup2(int fd, int fd2) __attribute__((__visibility__("default"))); diff --git a/storage/tokudb/PerconaFT/portability/toku_portability.h b/storage/tokudb/PerconaFT/portability/toku_portability.h index 28ea8014f5305699301ea1b2a5a8f992730fbad4..1096467a35d4097e68cbab6aceb48c44a66a64fa 100644 --- a/storage/tokudb/PerconaFT/portability/toku_portability.h +++ b/storage/tokudb/PerconaFT/portability/toku_portability.h @@ -125,6 +125,33 @@ typedef int64_t toku_off_t; #define UU(x) x __attribute__((__unused__)) +// Branch prediction macros. +// If supported by the compiler, will hint in inctruction caching for likely +// branching. Should only be used where there is a very good idea of the correct +// branch heuristics as determined by profiling. Mostly copied from InnoDB. +// Use: +// "if (FT_LIKELY(x))" where the chances of "x" evaluating true are higher +// "if (FT_UNLIKELY(x))" where the chances of "x" evaluating false are higher +#if defined(__GNUC__) && (__GNUC__ > 2) && !defined(__INTEL_COMPILER) + +// Tell the compiler that 'expr' probably evaluates to 'constant'. +#define FT_EXPECT(expr, constant) __builtin_expect(expr, constant) + +#else + +#warning "No FT branch prediction operations in use!" +#define FT_EXPECT(expr, constant) (expr) + +#endif // defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) + +// Tell the compiler that cond is likely to hold +#define FT_LIKELY(cond) FT_EXPECT(bool(cond), true) + +// Tell the compiler that cond is unlikely to hold +#define FT_UNLIKELY(cond) FT_EXPECT(bool(cond), false) + +#include "toku_instrumentation.h" + #if defined(__cplusplus) extern "C" { #endif @@ -240,28 +267,272 @@ void toku_os_full_write (int fd, const void *buf, size_t len) __attribute__((__v // os_write returns 0 on success, otherwise an errno. ssize_t toku_os_pwrite (int fd, const void *buf, size_t len, toku_off_t off) __attribute__((__visibility__("default"))); -int toku_os_write (int fd, const void *buf, size_t len) __attribute__((__visibility__("default"))); +int toku_os_write(int fd, const void *buf, size_t len) + __attribute__((__visibility__("default"))); // wrappers around file system calls -FILE * toku_os_fdopen(int fildes, const char *mode); -FILE * toku_os_fopen(const char *filename, const char *mode); -int toku_os_open(const char *path, int oflag, int mode); -int toku_os_open_direct(const char *path, int oflag, int mode); -int toku_os_close(int fd); -int toku_os_fclose(FILE * stream); -int toku_os_rename(const char *old_name, const char *new_name); -int toku_os_unlink(const char *path); -ssize_t toku_os_read(int fd, void *buf, size_t count); -ssize_t toku_os_pread(int fd, void *buf, size_t count, off_t offset); void toku_os_recursive_delete(const char *path); +TOKU_FILE *toku_os_fdopen_with_source_location(int fildes, + const char *mode, + const char *filename, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line); +#define toku_os_fdopen(FD, M, FN, K) \ + toku_os_fdopen_with_source_location(FD, M, FN, K, __FILE__, __LINE__) + +TOKU_FILE *toku_os_fopen_with_source_location(const char *filename, + const char *mode, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line); +#define toku_os_fopen(F, M, K) \ + toku_os_fopen_with_source_location(F, M, K, __FILE__, __LINE__) + +int toku_os_open_with_source_location(const char *path, + int oflag, + int mode, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line); +#define toku_os_open(FD, F, M, K) \ + toku_os_open_with_source_location(FD, F, M, K, __FILE__, __LINE__) + +int toku_os_open_direct(const char *path, + int oflag, + int mode, + const toku_instr_key &instr_key); + +int toku_os_delete_with_source_location(const char *name, + const char *src_file, + uint src_line); +#define toku_os_delete(FN) \ + toku_os_delete_with_source_location(FN, __FILE__, __LINE__) + +int toku_os_rename_with_source_location(const char *old_name, + const char *new_name, + const char *src_file, + uint src_line); +#define toku_os_rename(old_name, new_name) \ + toku_os_rename_with_source_location(old_name, new_name, __FILE__, __LINE__) + +void toku_os_full_write_with_source_location(int fd, + const void *buf, + size_t len, + const char *src_file, + uint src_line); +#define toku_os_full_write(FD, B, L) \ + toku_os_full_write_with_source_location(FD, B, L, __FILE__, __LINE__) + +int toku_os_write_with_source_location(int fd, + const void *buf, + size_t len, + const char *src_file, + uint src_line); +#define toku_os_write(FD, B, L) \ + toku_os_write_with_source_location(FD, B, L, __FILE__, __LINE__) + +void toku_os_full_pwrite_with_source_location(int fd, + const void *buf, + size_t len, + toku_off_t off, + const char *src_file, + uint src_line); +#define toku_os_full_pwrite(FD, B, L, O) \ + toku_os_full_pwrite_with_source_location(FD, B, L, O, __FILE__, __LINE__) + +ssize_t toku_os_pwrite_with_source_location(int fd, + const void *buf, + size_t len, + toku_off_t off, + const char *src_file, + uint src_line); + +#define toku_os_pwrite(FD, B, L, O) \ + toku_os_pwrite_with_source_location(FD, B, L, O, __FILE__, __LINE__) + +int toku_os_fwrite_with_source_location(const void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + const char *src_file, + uint src_line); + +#define toku_os_fwrite(P, S, N, FS) \ + toku_os_fwrite_with_source_location(P, S, N, FS, __FILE__, __LINE__) + +int toku_os_fread_with_source_location(void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + const char *src_file, + uint src_line); +#define toku_os_fread(P, S, N, FS) \ + toku_os_fread_with_source_location(P, S, N, FS, __FILE__, __LINE__) + +TOKU_FILE *toku_os_fopen_with_source_location(const char *filename, + const char *mode, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line); + +int toku_os_fclose_with_source_location(TOKU_FILE *stream, + const char *src_file, + uint src_line); + +#define toku_os_fclose(FS) \ + toku_os_fclose_with_source_location(FS, __FILE__, __LINE__) + +int toku_os_close_with_source_location(int fd, + const char *src_file, + uint src_line); +#define toku_os_close(FD) \ + toku_os_close_with_source_location(FD, __FILE__, __LINE__) + +ssize_t toku_os_read_with_source_location(int fd, + void *buf, + size_t count, + const char *src_file, + uint src_line); + +#define toku_os_read(FD, B, C) \ + toku_os_read_with_source_location(FD, B, C, __FILE__, __LINE__); + +ssize_t inline_toku_os_pread_with_source_location(int fd, + void *buf, + size_t count, + off_t offset, + const char *src_file, + uint src_line); +#define toku_os_pread(FD, B, C, O) \ + inline_toku_os_pread_with_source_location(FD, B, C, O, __FILE__, __LINE__); + +void file_fsync_internal_with_source_location(int fd, + const char *src_file, + uint src_line); + +#define file_fsync_internal(FD) \ + file_fsync_internal_with_source_location(FD, __FILE__, __LINE__); + +int toku_os_get_file_size_with_source_location(int fildes, + int64_t *fsize, + const char *src_file, + uint src_line); + +#define toku_os_get_file_size(D, S) \ + toku_os_get_file_size_with_source_location(D, S, __FILE__, __LINE__) + +// TODO: should this prototype be moved to toku_os.h? +int toku_stat_with_source_location(const char *name, + toku_struct_stat *buf, + const toku_instr_key &instr_key, + const char *src_file, + uint src_line) + __attribute__((__visibility__("default"))); + +#define toku_stat(N, B, K) \ + toku_stat_with_source_location(N, B, K, __FILE__, __LINE__) + +int toku_os_fstat_with_source_location(int fd, + toku_struct_stat *buf, + const char *src_file, + uint src_line) + __attribute__((__visibility__("default"))); + +#define toku_os_fstat(FD, B) \ + toku_os_fstat_with_source_location(FD, B, __FILE__, __LINE__) + +#ifdef HAVE_PSI_FILE_INTERFACE2 +int inline_toku_os_close(int fd, const char *src_file, uint src_line); +int inline_toku_os_fclose(TOKU_FILE *stream, + const char *src_file, + uint src_line); +ssize_t inline_toku_os_read(int fd, + void *buf, + size_t count, + const char *src_file, + uint src_line); +ssize_t inline_toku_os_pread(int fd, + void *buf, + size_t count, + off_t offset, + const char *src_file, + uint src_line); +int inline_toku_os_fwrite(const void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + const char *src_file, + uint src_line); +int inline_toku_os_fread(void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream, + const char *src_file, + uint src_line); +int inline_toku_os_write(int fd, + const void *buf, + size_t len, + const char *src_file, + uint src_line); +ssize_t inline_toku_os_pwrite(int fd, + const void *buf, + size_t len, + toku_off_t off, + const char *src_file, + uint src_line); +void inline_toku_os_full_write(int fd, + const void *buf, + size_t len, + const char *src_file, + uint src_line); +void inline_toku_os_full_pwrite(int fd, + const void *buf, + size_t len, + toku_off_t off, + const char *src_file, + uint src_line); +int inline_toku_os_delete(const char *name, + const char *srv_file, + uint src_line); +//#else +int inline_toku_os_close(int fd); +int inline_toku_os_fclose(TOKU_FILE *stream); +ssize_t inline_toku_os_read(int fd, void *buf, size_t count); +ssize_t inline_toku_os_pread(int fd, void *buf, size_t count, off_t offset); +int inline_toku_os_fwrite(const void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream); +int inline_toku_os_fread(void *ptr, + size_t size, + size_t nmemb, + TOKU_FILE *stream); +int inline_toku_os_write(int fd, const void *buf, size_t len); +ssize_t inline_toku_os_pwrite(int fd, + const void *buf, + size_t len, + toku_off_t off); +void inline_toku_os_full_write(int fd, const void *buf, size_t len); +void inline_toku_os_full_pwrite(int fd, + const void *buf, + size_t len, + toku_off_t off); +int inline_toku_os_delete(const char *name); +#endif + // wrapper around fsync -void toku_file_fsync_without_accounting(int fd); void toku_file_fsync(int fd); int toku_fsync_directory(const char *fname); +void toku_file_fsync_without_accounting(int fd); // get the number of fsync calls and the fsync times (total) -void toku_get_fsync_times(uint64_t *fsync_count, uint64_t *fsync_time, uint64_t *long_fsync_threshold, uint64_t *long_fsync_count, uint64_t *long_fsync_time); +void toku_get_fsync_times(uint64_t *fsync_count, + uint64_t *fsync_time, + uint64_t *long_fsync_threshold, + uint64_t *long_fsync_count, + uint64_t *long_fsync_time); void toku_set_func_fsync (int (*fsync_function)(int)); void toku_set_func_pwrite (ssize_t (*)(int, const void *, size_t, toku_off_t)); @@ -271,9 +542,11 @@ void toku_set_func_full_write (ssize_t (*)(int, const void *, size_t)); void toku_set_func_fdopen (FILE * (*)(int, const char *)); void toku_set_func_fopen (FILE * (*)(const char *, const char *)); void toku_set_func_open (int (*)(const char *, int, int)); -void toku_set_func_fclose(int (*)(FILE*)); +void toku_set_func_fclose(int (*)(FILE *)); void toku_set_func_read(ssize_t (*)(int, void *, size_t)); -void toku_set_func_pread (ssize_t (*)(int, void *, size_t, off_t)); +void toku_set_func_pread(ssize_t (*)(int, void *, size_t, off_t)); +void toku_set_func_fwrite( + size_t (*fwrite_fun)(const void *, size_t, size_t, FILE *)); int toku_portability_init(void); void toku_portability_destroy(void); @@ -283,28 +556,3 @@ void toku_portability_destroy(void); static inline uint64_t roundup_to_multiple(uint64_t alignment, uint64_t v) { return (v + alignment - 1) & ~(alignment - 1); } - -// Branch prediction macros. -// If supported by the compiler, will hint in inctruction caching for likely -// branching. Should only be used where there is a very good idea of the correct -// branch heuristics as determined by profiling. Mostly copied from InnoDB. -// Use: -// "if (FT_LIKELY(x))" where the chances of "x" evaluating true are higher -// "if (FT_UNLIKELY(x))" where the chances of "x" evaluating false are higher -#if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) - -// Tell the compiler that 'expr' probably evaluates to 'constant'. -#define FT_EXPECT(expr,constant) __builtin_expect(expr, constant) - -#else - -#warning "No FT branch prediction operations in use!" -#define FT_EXPECT(expr,constant) (expr) - -#endif // defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) - -// Tell the compiler that cond is likely to hold -#define FT_LIKELY(cond) FT_EXPECT(cond, 1) - -// Tell the compiler that cond is unlikely to hold -#define FT_UNLIKELY(cond) FT_EXPECT(cond, 0) diff --git a/storage/tokudb/PerconaFT/portability/toku_pthread.h b/storage/tokudb/PerconaFT/portability/toku_pthread.h index 84c277362010f63a0fe98566c25f3d880cbe0cbc..44de01244d256adfa6311afbd6360df26d513b6e 100644 --- a/storage/tokudb/PerconaFT/portability/toku_pthread.h +++ b/storage/tokudb/PerconaFT/portability/toku_pthread.h @@ -42,31 +42,62 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include #include +#include "toku_portability.h" #include "toku_assert.h" +// TODO: some things moved toku_instrumentation.h, not necessarily the best +// place typedef pthread_attr_t toku_pthread_attr_t; typedef pthread_t toku_pthread_t; -typedef pthread_mutexattr_t toku_pthread_mutexattr_t; typedef pthread_mutex_t toku_pthread_mutex_t; typedef pthread_condattr_t toku_pthread_condattr_t; typedef pthread_cond_t toku_pthread_cond_t; -typedef pthread_rwlock_t toku_pthread_rwlock_t; -typedef pthread_rwlockattr_t toku_pthread_rwlockattr_t; +typedef pthread_rwlockattr_t toku_pthread_rwlockattr_t; typedef pthread_key_t toku_pthread_key_t; typedef struct timespec toku_timespec_t; -#ifndef TOKU_PTHREAD_DEBUG -# define TOKU_PTHREAD_DEBUG 0 -#endif +// TODO: break this include loop +#include +typedef pthread_mutexattr_t toku_pthread_mutexattr_t; -typedef struct toku_mutex { +struct toku_mutex_t { pthread_mutex_t pmutex; + struct PSI_mutex + *psi_mutex; /* The performance schema instrumentation hook */ #if TOKU_PTHREAD_DEBUG - pthread_t owner; // = pthread_self(); // for debugging + pthread_t owner; // = pthread_self(); // for debugging bool locked; bool valid; + pfs_key_t instr_key_id; +#endif +}; + +struct toku_cond_t { + pthread_cond_t pcond; + struct PSI_cond *psi_cond; +#if TOKU_PTHREAD_DEBUG + pfs_key_t instr_key_id; +#endif +}; + +#ifdef TOKU_PTHREAD_DEBUG +#define TOKU_COND_INITIALIZER \ + { \ + .pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr, \ + .instr_key_id = 0 \ + } +#else +#define TOKU_COND_INITIALIZER \ + { .pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr } #endif -} toku_mutex_t; + +struct toku_pthread_rwlock_t { + pthread_rwlock_t rwlock; + struct PSI_rwlock *psi_rwlock; +#if TOKU_PTHREAD_DEBUG + pfs_key_t instr_key_id; +#endif +}; typedef struct toku_mutex_aligned { toku_mutex_t aligned_mutex __attribute__((__aligned__(64))); @@ -83,45 +114,68 @@ typedef struct toku_mutex_aligned { // In general it will be a lot of busy work to make this codebase compile // cleanly with -Wmissing-field-initializers -# define ZERO_MUTEX_INITIALIZER {} +#define ZERO_MUTEX_INITIALIZER \ + {} #if TOKU_PTHREAD_DEBUG -# define TOKU_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true } +#define TOKU_MUTEX_INITIALIZER \ + { \ + .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \ + .locked = false, .valid = true, .instr_key_id = 0 \ + } #else -# define TOKU_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER } +#define TOKU_MUTEX_INITIALIZER \ + { .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr } #endif // Darwin doesn't provide adaptive mutexes #if defined(__APPLE__) -# define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT -# if TOKU_PTHREAD_DEBUG -# define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER, .owner = 0, .locked = false, .valid = true } -# else -# define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_MUTEX_INITIALIZER } -# endif -#else // __FreeBSD__, __linux__, at least -# define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_ADAPTIVE_NP -# if TOKU_PTHREAD_DEBUG -# define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .owner = 0, .locked = false, .valid = true } -# else -# define TOKU_ADAPTIVE_MUTEX_INITIALIZER { .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP } -# endif +#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT +#if TOKU_PTHREAD_DEBUG +#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \ + { \ + .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \ + .locked = false, .valid = true, .instr_key_id = 0 \ + } +#else +#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \ + { .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr } #endif - -static inline void -toku_mutex_init(toku_mutex_t *mutex, const toku_pthread_mutexattr_t *attr) { - int r = pthread_mutex_init(&mutex->pmutex, attr); - assert_zero(r); +#else // __FreeBSD__, __linux__, at least +#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_ADAPTIVE_NP #if TOKU_PTHREAD_DEBUG - mutex->locked = false; - invariant(!mutex->valid); - mutex->valid = true; - mutex->owner = 0; +#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \ + { \ + .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr, \ + .owner = 0, .locked = false, .valid = true, .instr_key_id = 0 \ + } +#else +#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \ + { .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr } +#endif #endif -} -static inline void -toku_mutexattr_init(toku_pthread_mutexattr_t *attr) { +// Different OSes implement mutexes as different amounts of nested structs. +// C++ will fill out all missing values with zeroes if you provide at least one +// zero, but it needs the right amount of nesting. +#if defined(__FreeBSD__) +#define ZERO_COND_INITIALIZER \ + { 0 } +#elif defined(__APPLE__) +#define ZERO_COND_INITIALIZER \ + { \ + { 0 } \ + } +#else // __linux__, at least +#define ZERO_COND_INITIALIZER \ + { \ + { \ + { 0 } \ + } \ + } +#endif + +static inline void toku_mutexattr_init(toku_pthread_mutexattr_t *attr) { int r = pthread_mutexattr_init(attr); assert_zero(r); } @@ -138,61 +192,8 @@ toku_mutexattr_destroy(toku_pthread_mutexattr_t *attr) { assert_zero(r); } -static inline void -toku_mutex_destroy(toku_mutex_t *mutex) { #if TOKU_PTHREAD_DEBUG - invariant(mutex->valid); - mutex->valid = false; - invariant(!mutex->locked); -#endif - int r = pthread_mutex_destroy(&mutex->pmutex); - assert_zero(r); -} - -static inline void -toku_mutex_lock(toku_mutex_t *mutex) { - int r = pthread_mutex_lock(&mutex->pmutex); - assert_zero(r); -#if TOKU_PTHREAD_DEBUG - invariant(mutex->valid); - invariant(!mutex->locked); - invariant(mutex->owner == 0); - mutex->locked = true; - mutex->owner = pthread_self(); -#endif -} - -static inline int -toku_mutex_trylock(toku_mutex_t *mutex) { - int r = pthread_mutex_trylock(&mutex->pmutex); -#if TOKU_PTHREAD_DEBUG - if (r == 0) { - invariant(mutex->valid); - invariant(!mutex->locked); - invariant(mutex->owner == 0); - mutex->locked = true; - mutex->owner = pthread_self(); - } -#endif - return r; -} - -static inline void -toku_mutex_unlock(toku_mutex_t *mutex) { -#if TOKU_PTHREAD_DEBUG - invariant(mutex->owner == pthread_self()); - invariant(mutex->valid); - invariant(mutex->locked); - mutex->locked = false; - mutex->owner = 0; -#endif - int r = pthread_mutex_unlock(&mutex->pmutex); - assert_zero(r); -} - -#if TOKU_PTHREAD_DEBUG -static inline void -toku_mutex_assert_locked(const toku_mutex_t *mutex) { +static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) { invariant(mutex->locked); invariant(mutex->owner == pthread_self()); } @@ -217,40 +218,123 @@ toku_mutex_assert_unlocked(toku_mutex_t *mutex) { invariant(!mutex->locked); } #else -static inline void -toku_mutex_assert_unlocked(toku_mutex_t *mutex __attribute__((unused))) { +static inline void toku_mutex_assert_unlocked(toku_mutex_t *mutex + __attribute__((unused))) {} +#endif + +#define toku_mutex_lock(M) \ + toku_mutex_lock_with_source_location(M, __FILE__, __LINE__) + +static inline void toku_cond_init(toku_cond_t *cond, + const toku_pthread_condattr_t *attr) { + int r = pthread_cond_init(&cond->pcond, attr); + assert_zero(r); +} + +#define toku_mutex_trylock(M) \ + toku_mutex_trylock_with_source_location(M, __FILE__, __LINE__) + +inline void toku_mutex_unlock(toku_mutex_t *mutex) { +#if TOKU_PTHREAD_DEBUG + invariant(mutex->owner == pthread_self()); + invariant(mutex->valid); + invariant(mutex->locked); + mutex->locked = false; + mutex->owner = 0; +#endif + toku_instr_mutex_unlock(mutex->psi_mutex); + int r = pthread_mutex_unlock(&mutex->pmutex); + assert_zero(r); } + +inline void toku_mutex_lock_with_source_location(toku_mutex_t *mutex, + const char *src_file, + int src_line) { + + toku_mutex_instrumentation mutex_instr; + toku_instr_mutex_lock_start(mutex_instr, *mutex, src_file, src_line); + + const int r = pthread_mutex_lock(&mutex->pmutex); + toku_instr_mutex_lock_end(mutex_instr, r); + + assert_zero(r); +#if TOKU_PTHREAD_DEBUG + invariant(mutex->valid); + invariant(!mutex->locked); + invariant(mutex->owner == 0); + mutex->locked = true; + mutex->owner = pthread_self(); #endif +} -typedef struct toku_cond { - pthread_cond_t pcond; -} toku_cond_t; +inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex, + const char *src_file, + int src_line) { -// Same considerations as for ZERO_MUTEX_INITIALIZER apply -#define ZERO_COND_INITIALIZER {} + toku_mutex_instrumentation mutex_instr; + toku_instr_mutex_trylock_start(mutex_instr, *mutex, src_file, src_line); -#define TOKU_COND_INITIALIZER {PTHREAD_COND_INITIALIZER} + const int r = pthread_mutex_lock(&mutex->pmutex); + toku_instr_mutex_lock_end(mutex_instr, r); -static inline void -toku_cond_init(toku_cond_t *cond, const toku_pthread_condattr_t *attr) { +#if TOKU_PTHREAD_DEBUG + if (r == 0) { + invariant(mutex->valid); + invariant(!mutex->locked); + invariant(mutex->owner == 0); + mutex->locked = true; + mutex->owner = pthread_self(); + } +#endif + return r; +} + +#define toku_cond_wait(C, M) \ + toku_cond_wait_with_source_location(C, M, __FILE__, __LINE__) + +#define toku_cond_timedwait(C, M, W) \ + toku_cond_timedwait_with_source_location(C, M, W, __FILE__, __LINE__) + +inline void toku_cond_init(const toku_instr_key &key, + toku_cond_t *cond, + const pthread_condattr_t *attr) { + toku_instr_cond_init(key, *cond); int r = pthread_cond_init(&cond->pcond, attr); assert_zero(r); } -static inline void -toku_cond_destroy(toku_cond_t *cond) { +inline void toku_cond_destroy(toku_cond_t *cond) { + toku_instr_cond_destroy(cond->psi_cond); int r = pthread_cond_destroy(&cond->pcond); assert_zero(r); } -static inline void -toku_cond_wait(toku_cond_t *cond, toku_mutex_t *mutex) { +inline void toku_cond_wait_with_source_location(toku_cond_t *cond, + toku_mutex_t *mutex, + const char *src_file, + uint src_line) { + #if TOKU_PTHREAD_DEBUG invariant(mutex->locked); mutex->locked = false; mutex->owner = 0; #endif - int r = pthread_cond_wait(&cond->pcond, &mutex->pmutex); + + /* Instrumentation start */ + toku_cond_instrumentation cond_instr; + toku_instr_cond_wait_start(cond_instr, + toku_instr_cond_op::cond_wait, + *cond, + *mutex, + src_file, + src_line); + + /* Instrumented code */ + const int r = pthread_cond_wait(&cond->pcond, &mutex->pmutex); + + /* Instrumentation end */ + toku_instr_cond_wait_end(cond_instr, r); + assert_zero(r); #if TOKU_PTHREAD_DEBUG invariant(!mutex->locked); @@ -259,14 +343,33 @@ toku_cond_wait(toku_cond_t *cond, toku_mutex_t *mutex) { #endif } -static inline int -toku_cond_timedwait(toku_cond_t *cond, toku_mutex_t *mutex, toku_timespec_t *wakeup_at) { +inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond, + toku_mutex_t *mutex, + toku_timespec_t *wakeup_at, + const char *src_file, + uint src_line) { #if TOKU_PTHREAD_DEBUG invariant(mutex->locked); mutex->locked = false; mutex->owner = 0; #endif - int r = pthread_cond_timedwait(&cond->pcond, &mutex->pmutex, wakeup_at); + + /* Instrumentation start */ + toku_cond_instrumentation cond_instr; + toku_instr_cond_wait_start(cond_instr, + toku_instr_cond_op::cond_timedwait, + *cond, + *mutex, + src_file, + src_line); + + /* Instrumented code */ + const int r = pthread_cond_timedwait( + &cond->pcond, &mutex->pmutex, wakeup_at); + + /* Instrumentation end */ + toku_instr_cond_wait_end(cond_instr, r); + #if TOKU_PTHREAD_DEBUG invariant(!mutex->locked); mutex->locked = true; @@ -275,69 +378,116 @@ toku_cond_timedwait(toku_cond_t *cond, toku_mutex_t *mutex, toku_timespec_t *wak return r; } -static inline void -toku_cond_signal(toku_cond_t *cond) { - int r = pthread_cond_signal(&cond->pcond); +inline void toku_cond_signal(toku_cond_t *cond) { + toku_instr_cond_signal(*cond); + const int r = pthread_cond_signal(&cond->pcond); assert_zero(r); } -static inline void -toku_cond_broadcast(toku_cond_t *cond) { - int r =pthread_cond_broadcast(&cond->pcond); +inline void toku_cond_broadcast(toku_cond_t *cond) { + toku_instr_cond_broadcast(*cond); + const int r = pthread_cond_broadcast(&cond->pcond); assert_zero(r); } -int -toku_pthread_yield(void) __attribute__((__visibility__("default"))); - -static inline toku_pthread_t -toku_pthread_self(void) { - return pthread_self(); +inline void toku_mutex_init(const toku_instr_key &key, + toku_mutex_t *mutex, + const toku_pthread_mutexattr_t *attr) { +#if TOKU_PTHREAD_DEBUG + mutex->valid = true; +#endif + toku_instr_mutex_init(key, *mutex); + const int r = pthread_mutex_init(&mutex->pmutex, attr); + assert_zero(r); +#if TOKU_PTHREAD_DEBUG + mutex->locked = false; + invariant(mutex->valid); + mutex->valid = true; + mutex->owner = 0; +#endif } -static inline void -toku_pthread_rwlock_init(toku_pthread_rwlock_t *__restrict rwlock, const toku_pthread_rwlockattr_t *__restrict attr) { - int r = pthread_rwlock_init(rwlock, attr); +inline void toku_mutex_destroy(toku_mutex_t *mutex) { +#if TOKU_PTHREAD_DEBUG + invariant(mutex->valid); + mutex->valid = false; + invariant(!mutex->locked); +#endif + toku_instr_mutex_destroy(mutex->psi_mutex); + int r = pthread_mutex_destroy(&mutex->pmutex); assert_zero(r); } -static inline void -toku_pthread_rwlock_destroy(toku_pthread_rwlock_t *rwlock) { - int r = pthread_rwlock_destroy(rwlock); +#define toku_pthread_rwlock_rdlock(RW) \ + toku_pthread_rwlock_rdlock_with_source_location(RW, __FILE__, __LINE__) + +#define toku_pthread_rwlock_wrlock(RW) \ + toku_pthread_rwlock_wrlock_with_source_location(RW, __FILE__, __LINE__) + +inline void toku_pthread_rwlock_init( + const toku_instr_key &key, + toku_pthread_rwlock_t *__restrict rwlock, + const toku_pthread_rwlockattr_t *__restrict attr) { + toku_instr_rwlock_init(key, *rwlock); + int r = pthread_rwlock_init(&rwlock->rwlock, attr); assert_zero(r); } -static inline void -toku_pthread_rwlock_rdlock(toku_pthread_rwlock_t *rwlock) { - int r = pthread_rwlock_rdlock(rwlock); +inline void toku_pthread_rwlock_destroy(toku_pthread_rwlock_t *rwlock) { + toku_instr_rwlock_destroy(rwlock->psi_rwlock); + int r = pthread_rwlock_destroy(&rwlock->rwlock); assert_zero(r); } -static inline void -toku_pthread_rwlock_rdunlock(toku_pthread_rwlock_t *rwlock) { - int r = pthread_rwlock_unlock(rwlock); +inline void toku_pthread_rwlock_rdlock_with_source_location( + toku_pthread_rwlock_t *rwlock, + const char *src_file, + uint src_line) { + + /* Instrumentation start */ + toku_rwlock_instrumentation rwlock_instr; + toku_instr_rwlock_rdlock_wait_start( + rwlock_instr, *rwlock, src_file, src_line); + /* Instrumented code */ + const int r = pthread_rwlock_rdlock(&rwlock->rwlock); + + /* Instrumentation end */ + toku_instr_rwlock_rdlock_wait_end(rwlock_instr, r); + assert_zero(r); } -static inline void -toku_pthread_rwlock_wrlock(toku_pthread_rwlock_t *rwlock) { - int r = pthread_rwlock_wrlock(rwlock); +inline void toku_pthread_rwlock_wrlock_with_source_location( + toku_pthread_rwlock_t *rwlock, + const char *src_file, + uint src_line) { + + /* Instrumentation start */ + toku_rwlock_instrumentation rwlock_instr; + toku_instr_rwlock_wrlock_wait_start( + rwlock_instr, *rwlock, src_file, src_line); + /* Instrumented code */ + const int r = pthread_rwlock_wrlock(&rwlock->rwlock); + + /* Instrumentation end */ + toku_instr_rwlock_wrlock_wait_end(rwlock_instr, r); + assert_zero(r); } -static inline void -toku_pthread_rwlock_wrunlock(toku_pthread_rwlock_t *rwlock) { - int r = pthread_rwlock_unlock(rwlock); +inline void toku_pthread_rwlock_rdunlock(toku_pthread_rwlock_t *rwlock) { + toku_instr_rwlock_unlock(*rwlock); + const int r = pthread_rwlock_unlock(&rwlock->rwlock); assert_zero(r); } -static inline int -toku_pthread_create(toku_pthread_t *thread, const toku_pthread_attr_t *attr, void *(*start_function)(void *), void *arg) { - return pthread_create(thread, attr, start_function, arg); +inline void toku_pthread_rwlock_wrunlock(toku_pthread_rwlock_t *rwlock) { + toku_instr_rwlock_unlock(*rwlock); + const int r = pthread_rwlock_unlock(&rwlock->rwlock); + assert_zero(r); } -static inline int -toku_pthread_join(toku_pthread_t thread, void **value_ptr) { +static inline int toku_pthread_join(toku_pthread_t thread, void **value_ptr) { return pthread_join(thread, value_ptr); } @@ -361,7 +511,15 @@ toku_pthread_getspecific(toku_pthread_key_t key) { return pthread_getspecific(key); } -static inline int -toku_pthread_setspecific(toku_pthread_key_t key, void *data) { +static inline int toku_pthread_setspecific(toku_pthread_key_t key, void *data) { return pthread_setspecific(key, data); } + +int toku_pthread_yield(void) __attribute__((__visibility__("default"))); + +static inline toku_pthread_t toku_pthread_self(void) { return pthread_self(); } + +static inline void *toku_pthread_done(void *exit_value) { + toku_instr_delete_current_thread(); + pthread_exit(exit_value); +} diff --git a/storage/tokudb/PerconaFT/src/indexer-undo-do.cc b/storage/tokudb/PerconaFT/src/indexer-undo-do.cc index 4c7f5336161da5479392d0251b5afb39e14d9b7e..cc86402751bbd24ec23118b42ff56b00e3febed4 100644 --- a/storage/tokudb/PerconaFT/src/indexer-undo-do.cc +++ b/storage/tokudb/PerconaFT/src/indexer-undo-do.cc @@ -571,6 +571,7 @@ indexer_ft_delete_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, XIDS xi oldest_referenced_xid_estimate, true); toku_ft_send_delete(db_struct_i(hotdb)->ft_handle, hotkey, xids, &gc_info); + toku_ft_adjust_logical_row_count(db_struct_i(hotdb)->ft_handle->ft, -1); } } return result; @@ -616,6 +617,7 @@ indexer_ft_insert_committed(DB_INDEXER *indexer, DB *hotdb, DBT *hotkey, DBT *ho oldest_referenced_xid_estimate, true); toku_ft_send_insert(db_struct_i(hotdb)->ft_handle, hotkey, hotval, xids, FT_INSERT, &gc_info); + toku_ft_adjust_logical_row_count(db_struct_i(hotdb)->ft_handle->ft, 1); } } return result; diff --git a/storage/tokudb/PerconaFT/src/indexer.cc b/storage/tokudb/PerconaFT/src/indexer.cc index b475b08beb5964fc835c3f16cc767eb35eeb890b..044ffac917c7957ac980345328a1fecf01607a88 100644 --- a/storage/tokudb/PerconaFT/src/indexer.cc +++ b/storage/tokudb/PerconaFT/src/indexer.cc @@ -253,16 +253,21 @@ toku_indexer_create_indexer(DB_ENV *env, indexer->set_error_callback = toku_indexer_set_error_callback; indexer->set_poll_function = toku_indexer_set_poll_function; indexer->build = build_index; - indexer->close = close_indexer; - indexer->abort = abort_indexer; - - toku_mutex_init(&indexer->i->indexer_lock, NULL); - toku_mutex_init(&indexer->i->indexer_estimate_lock, NULL); + indexer->close = close_indexer; + indexer->abort = abort_indexer; + + toku_mutex_init( + *indexer_i_indexer_lock_mutex_key, &indexer->i->indexer_lock, nullptr); + toku_mutex_init(*indexer_i_indexer_estimate_lock_mutex_key, + &indexer->i->indexer_estimate_lock, + nullptr); toku_init_dbt(&indexer->i->position_estimate); // - // create and close a dummy loader to get redirection going for the hot indexer - // This way, if the hot index aborts, but other transactions have references to the + // create and close a dummy loader to get redirection going for the hot + // indexer + // This way, if the hot index aborts, but other transactions have references + // to the // underlying FT, then those transactions can do dummy operations on the FT // while the DB gets redirected back to an empty dictionary // diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc b/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc index d9d865254f1ee6035df40b91057b4a0343d1839a..3b53911e61479478397461e348b7217b23586435 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-first-empty.cc @@ -99,12 +99,14 @@ static void *blocking_first_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) { int r; toku_pthread_t tids[nthreads]; - struct blocking_first_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_first_thread, &a); assert(r == 0); + struct blocking_first_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_first_thread, &a); + assert(r == 0); } blocking_first(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-first.cc b/storage/tokudb/PerconaFT/src/tests/blocking-first.cc index 9f3f8f4eb6ae3ca7d9fa5ce6b016ef72f78ef0ef..c104eabd6c3fcf73387eb902ad0f45fb14a1d927 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-first.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-first.cc @@ -116,12 +116,14 @@ static void *blocking_first_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) { int r; toku_pthread_t tids[nthreads]; - struct blocking_first_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_first_thread, &a); assert(r == 0); + struct blocking_first_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_first_thread, &a); + assert(r == 0); } blocking_first(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-last.cc b/storage/tokudb/PerconaFT/src/tests/blocking-last.cc index a62d83eb46f1a209a9c49eebb202315654ddc711..3a702e3f115f3bf53c32a74d6ab4694cb3038a53 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-last.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-last.cc @@ -116,12 +116,14 @@ static void *blocking_last_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) { int r; toku_pthread_t tids[nthreads]; - struct blocking_last_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_last_thread, &a); assert(r == 0); + struct blocking_last_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_last_thread, &a); + assert(r == 0); } blocking_last(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc index bd5697ba5262b891f04b30e3317695699986157d..781708cc627d2ca3a6f96dbaae3eb09106b41606 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev-deadlock.cc @@ -181,12 +181,14 @@ static void *blocking_next_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) { int r; toku_pthread_t tids[nthreads]; - struct blocking_next_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_next_thread, &a); assert(r == 0); + struct blocking_next_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_next_thread, &a); + assert(r == 0); } blocking_prev(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc index 729473bb7cf73cefbe71e0fcc6895f30e1d09253..aa179e88d765e407f42ff76ae32fd98c1329f02a 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-next-prev.cc @@ -188,12 +188,14 @@ static void *blocking_next_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime) { int r; toku_pthread_t tids[nthreads]; - struct blocking_next_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_next_thread, &a); assert(r == 0); + struct blocking_next_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_next_thread, &a); + assert(r == 0); } blocking_prev(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc b/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc index 8821b39aa8a37c5153c5e252cea370e756513427..38875a2f8ecf12a4e8f01fe765481b5396da338c 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-prelock-range.cc @@ -140,12 +140,17 @@ int test_main(int argc, char * const argv[]) { r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); toku_pthread_t tids[nthreads]; - struct blocking_range_lock_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_range_lock_thread, &a); assert(r == 0); + struct blocking_range_lock_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create(toku_uninstrumented, + &tids[i], + nullptr, + blocking_range_lock_thread, + &a); + assert(r == 0); } blocking_range_lock(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc b/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc index a31e173fd83157761c24cc4cb1b7b2a8d31e1d9b..bf4a8a24f4737b3b93dfcf05a459221e90bcd4dc 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-put-timeout.cc @@ -57,8 +57,8 @@ struct test_seq { static void test_seq_init(struct test_seq *seq) { seq->state = 0; - toku_mutex_init(&seq->lock, NULL); - toku_cond_init(&seq->cv, NULL); + toku_mutex_init(toku_uninstrumented, &seq->lock, nullptr); + toku_cond_init(toku_uninstrumented, &seq->cv, nullptr); } static void test_seq_destroy(struct test_seq *seq) { @@ -172,13 +172,18 @@ int test_main(int argc, char * const argv[]) { r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); // run test - struct test_seq seq; ZERO_STRUCT(seq); test_seq_init(&seq); + struct test_seq seq; + ZERO_STRUCT(seq); + test_seq_init(&seq); toku_pthread_t t_a_id; - struct t_a_args t_a_args = { db_env, db, &seq }; - r = toku_pthread_create(&t_a_id, NULL, t_a_thread, &t_a_args); assert(r == 0); + struct t_a_args t_a_args = {db_env, db, &seq}; + r = toku_pthread_create( + toku_uninstrumented, &t_a_id, nullptr, t_a_thread, &t_a_args); + assert(r == 0); t_b(db_env, db, &seq); void *ret; - r = toku_pthread_join(t_a_id, &ret); assert(r == 0); + r = toku_pthread_join(t_a_id, &ret); + assert(r == 0); test_seq_destroy(&seq); // close env diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc b/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc index 615cdb5d17c2618d3a87b4b66c7bfd60981c03bf..dba7962de35bada430f17ada05fd19af0b73c849 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-put-wakeup.cc @@ -58,8 +58,8 @@ struct test_seq { static void test_seq_init(struct test_seq *seq) { seq->state = 0; - toku_mutex_init(&seq->lock, NULL); - toku_cond_init(&seq->cv, NULL); + toku_mutex_init(toku_uninstrumented, &seq->lock, nullptr); + toku_cond_init(toku_uninstrumented, &seq->cv, nullptr); } static void test_seq_destroy(struct test_seq *seq) { @@ -167,13 +167,18 @@ int test_main(int argc, char * const argv[]) { r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); // run test - struct test_seq seq; ZERO_STRUCT(seq); test_seq_init(&seq); + struct test_seq seq; + ZERO_STRUCT(seq); + test_seq_init(&seq); toku_pthread_t t_a_id; - struct t_a_args t_a_args = { db_env, db, &seq }; - r = toku_pthread_create(&t_a_id, NULL, t_a_thread, &t_a_args); assert(r == 0); + struct t_a_args t_a_args = {db_env, db, &seq}; + r = toku_pthread_create( + toku_uninstrumented, &t_a_id, nullptr, t_a_thread, &t_a_args); + assert(r == 0); t_b(db_env, db, &seq); void *ret; - r = toku_pthread_join(t_a_id, &ret); assert(r == 0); + r = toku_pthread_join(t_a_id, &ret); + assert(r == 0); test_seq_destroy(&seq); // close env diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-put.cc b/storage/tokudb/PerconaFT/src/tests/blocking-put.cc index 0fa56325007fb896f27f45cc2db3a041f443ff87..95481062483b16373b8228171b74443f2604d283 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-put.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-put.cc @@ -139,12 +139,14 @@ int test_main(int argc, char * const argv[]) { r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); toku_pthread_t tids[nthreads]; - struct blocking_put_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_put_thread, &a); assert(r == 0); + struct blocking_put_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_put_thread, &a); + assert(r == 0); } blocking_put(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc index a0e03ab3293f695b058749c46a60f75744bf2f1c..7c2e7b0fb26988571d819739649aa91621cc430b 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-0.cc @@ -126,12 +126,15 @@ static void *blocking_set_range_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime, uint64_t the_key) { int r; toku_pthread_t tids[nthreads]; - struct blocking_set_range_args a = { db_env, db, nrows, sleeptime, the_key }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_set_range_thread, &a); assert(r == 0); + struct blocking_set_range_args a = {db_env, db, nrows, sleeptime, the_key}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, + blocking_set_range_thread, &a); + assert(r == 0); } blocking_set_range(db_env, db, nrows, sleeptime, the_key); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc index 056d74dbdd2aa4b2de922d5a0108baf90c6db305..54a5846eb5e8007b7f6be1b711cbef2baaacfda8 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-n.cc @@ -121,12 +121,15 @@ static void *blocking_set_range_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime, uint64_t the_key) { int r; toku_pthread_t tids[nthreads]; - struct blocking_set_range_args a = { db_env, db, nrows, sleeptime, the_key }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_set_range_thread, &a); assert(r == 0); + struct blocking_set_range_args a = {db_env, db, nrows, sleeptime, the_key}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, + blocking_set_range_thread, &a); + assert(r == 0); } blocking_set_range(db_env, db, nrows, sleeptime, the_key); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc index 1e7fca85bffb51b5c2b03e0ab3c8dcea5def1df5..59e582547bfea4cc22e593bdc41623305b1bef06 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-set-range-reverse-0.cc @@ -126,12 +126,15 @@ static void *blocking_set_range_thread(void *arg) { static void run_test(DB_ENV *db_env, DB *db, int nthreads, uint64_t nrows, long sleeptime, uint64_t the_key) { int r; toku_pthread_t tids[nthreads]; - struct blocking_set_range_args a = { db_env, db, nrows, sleeptime, the_key }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_set_range_thread, &a); assert(r == 0); + struct blocking_set_range_args a = {db_env, db, nrows, sleeptime, the_key}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, + blocking_set_range_thread, &a); + assert(r == 0); } blocking_set_range(db_env, db, nrows, sleeptime, the_key); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-set.cc b/storage/tokudb/PerconaFT/src/tests/blocking-set.cc index ba64989842ad0a13b0ffe1d1636af767e66af3af..aa433c87be15da55ae2d05e601fdeeaa3c1a44c6 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-set.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-set.cc @@ -182,12 +182,14 @@ int test_main(int argc, char * const argv[]) { populate(db_env, db, nrows); toku_pthread_t tids[nthreads]; - struct blocking_set_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_set_thread, &a); assert(r == 0); + struct blocking_set_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, blocking_set_thread, &a); + assert(r == 0); } blocking_set(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc b/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc index 9ae33c566214468a9990e1547a2d8835c866dca6..0953a4e80de755de9464fe60d8611d403ca0debd 100644 --- a/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc +++ b/storage/tokudb/PerconaFT/src/tests/blocking-table-lock.cc @@ -133,12 +133,17 @@ int test_main(int argc, char * const argv[]) { r = db->open(db, NULL, db_filename, NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT|DB_THREAD, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); toku_pthread_t tids[nthreads]; - struct blocking_table_lock_args a = { db_env, db, nrows, sleeptime }; - for (int i = 0; i < nthreads-1; i++) { - r = toku_pthread_create(&tids[i], NULL, blocking_table_lock_thread, &a); assert(r == 0); + struct blocking_table_lock_args a = {db_env, db, nrows, sleeptime}; + for (int i = 0; i < nthreads - 1; i++) { + r = toku_pthread_create(toku_uninstrumented, + &tids[i], + nullptr, + blocking_table_lock_thread, + &a); + assert(r == 0); } blocking_table_lock(db_env, db, nrows, sleeptime); - for (int i = 0; i < nthreads-1; i++) { + for (int i = 0; i < nthreads - 1; i++) { void *ret; r = toku_pthread_join(tids[i], &ret); assert(r == 0); } diff --git a/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc b/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc index be82f8c352f978d2c758e11d8b14fe5be964f9de..f62dfbc76d38ee9d3f71d8f7405ddb70b6436224 100644 --- a/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc +++ b/storage/tokudb/PerconaFT/src/tests/checkpoint_fairness.cc @@ -113,10 +113,14 @@ int test_main(int argc, char * const argv[]) { { int chk_r = db->open(db, NULL, "db", NULL, DB_BTREE, DB_CREATE|DB_AUTO_COMMIT, 0666); CKERR(chk_r); } pthread_t thds[n_threads]; - int ids[n_threads]; - for (int i=0; i(dictionaries)); + CKERR(r); + // this thead will scribble over dictionary 0 before crash to verify + // that + // post-checkpoint inserts are not in the database + DB* db = dictionaries[0].db; + if (iter & 1) + scribble(db, iter); + else + thin_out(db, iter); + uint32_t delay = myrandom(); + delay &= + 0xFFF; // select lower 12 bits, shifted up 8 for random number ... + delay = delay << 8; // ... uniformly distributed between 0 and 1M ... + usleep(delay); // ... to sleep up to one second (1M usec) + drop_dead(); } else { for (i = 0; i < NUM_DICTIONARIES; i++) { diff --git a/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc b/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc index ada46bd751612871f7b31aa4c84c05293e497f4c..e5bcc6af7bba4228ab71d7c88191b71f64c924cd 100644 --- a/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc +++ b/storage/tokudb/PerconaFT/src/tests/db-put-simple-deadlock-threads.cc @@ -57,8 +57,8 @@ struct test_seq { static void test_seq_init(struct test_seq *seq) { seq->state = 0; - toku_mutex_init(&seq->lock, NULL); - toku_cond_init(&seq->cv, NULL); + toku_mutex_init(toku_uninstrumented, &seq->lock, nullptr); + toku_cond_init(toku_uninstrumented, &seq->cv, nullptr); } static void test_seq_destroy(struct test_seq *seq) { @@ -146,8 +146,9 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) { struct test_seq test_seq; ZERO_STRUCT(test_seq); test_seq_init(&test_seq); toku_pthread_t tid; - struct run_txn_b_arg arg = { &test_seq, txn_b, db, n}; - r = toku_pthread_create(&tid, NULL, run_txn_b, &arg); + struct run_txn_b_arg arg = {&test_seq, txn_b, db, n}; + r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, run_txn_b, &arg); test_seq_sleep(&test_seq, 0); insert_row(db, txn_a, htonl(0), 0, 0); diff --git a/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc b/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc index 365ea39ecedc35250ade13c6af42be6f4662decf..0fbe851532ef5ab3cc71ba48eb0aa3b423ecb56d 100644 --- a/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc +++ b/storage/tokudb/PerconaFT/src/tests/db-put-simple-lockwait.cc @@ -95,10 +95,11 @@ static void simple_lockwait(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n insert_row(db, txns[0], htonl(0), 0, 0); toku_pthread_t tids[ntxns]; - for (int i = 1 ; i < ntxns; i++) { + for (int i = 1; i < ntxns; i++) { struct insert_one_arg *XMALLOC(arg); - *arg = (struct insert_one_arg) { txns[i], db}; - r = toku_pthread_create(&tids[i], NULL, insert_one, arg); + *arg = (struct insert_one_arg){txns[i], db}; + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, insert_one, arg); } sleep(10); diff --git a/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc b/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc index 3660f11d1bd62ca86b1095b1023c8e6dd961d211..7a968058d7fb44c5ba019fb7131d3fb80e7d0f23 100644 --- a/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc +++ b/storage/tokudb/PerconaFT/src/tests/db-put-update-deadlock.cc @@ -128,10 +128,12 @@ static void update_deadlock(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n // get write locks toku_pthread_t tids[ntxns]; - for (int i = 0 ; i < ntxns; i++) { + for (int i = 0; i < ntxns; i++) { struct write_one_arg *XMALLOC(arg); - *arg = (struct write_one_arg) { txns[i], db, (int) htonl((i + 1) % ntxns), 0}; - r = toku_pthread_create(&tids[i], NULL, write_one_f, arg); + *arg = + (struct write_one_arg){txns[i], db, (int)htonl((i + 1) % ntxns), 0}; + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, write_one_f, arg); } #else // get read locks @@ -141,10 +143,11 @@ static void update_deadlock(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n // get write locks toku_pthread_t tids[ntxns]; - for (int i = 0 ; i < ntxns; i++) { + for (int i = 0; i < ntxns; i++) { struct write_one_arg *XMALLOC(arg); - *arg = (struct write_one_arg) { txns[i], db, (int) htonl(0), 0}; - r = toku_pthread_create(&tids[i], NULL, write_one_f, arg); + *arg = (struct write_one_arg){txns[i], db, (int)htonl(0), 0}; + r = toku_pthread_create( + toku_uninstrumented, &tids[i], nullptr, write_one_f, arg); } #endif diff --git a/storage/tokudb/PerconaFT/src/tests/filesize.cc b/storage/tokudb/PerconaFT/src/tests/filesize.cc index 6ab22245e6896156fe681729f3c1fdc1a0dcc21f..9dfeea131c6ab93ba87e19099edeefa3ebd1bbb6 100644 --- a/storage/tokudb/PerconaFT/src/tests/filesize.cc +++ b/storage/tokudb/PerconaFT/src/tests/filesize.cc @@ -170,11 +170,9 @@ get_file_pathname(void) { if (verbose) printf("path = %s\n", path); } - -static int -getsizeM(void) { +static int getsizeM(void) { toku_struct_stat buf; - int r = toku_stat(path, &buf); + int r = toku_stat(path, &buf, toku_uninstrumented); CKERR(r); int sizeM = (int)buf.st_size >> 20; check_fragmentation(); diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc index 82471f30e4561fe1730f018088dc5d29f9bb518b..5336bc3329f520ad4321cd6d8d0e565da696bb00 100644 --- a/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc +++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-bw.cc @@ -302,12 +302,19 @@ static void test_indexer(DB *src, DB **dbs) CKERR(r); toku_mutex_unlock(&put_lock); - // start threads doing additional inserts - no lock issues since indexer already created - r = toku_pthread_create(&client_threads[0], 0, client, (void *)&client_specs[0]); CKERR(r); -// r = toku_pthread_create(&client_threads[1], 0, client, (void *)&client_specs[1]); CKERR(r); + // start threads doing additional inserts - no lock issues since indexer + // already created + r = toku_pthread_create(toku_uninstrumented, + &client_threads[0], + nullptr, + client, + static_cast(&client_specs[0])); + CKERR(r); + // r = toku_pthread_create(toku_uninstrumented, &client_threads[1], 0, + // client, (void *)&client_specs[1]); CKERR(r); struct timeval start, now; - if ( verbose ) { + if (verbose) { printf("test_indexer build\n"); gettimeofday(&start,0); } @@ -342,14 +349,13 @@ static void test_indexer(DB *src, DB **dbs) if ( verbose ) printf("test_indexer done\n"); } - -static void run_test(void) -{ +static void run_test(void) { int r; - toku_mutex_init(&put_lock, NULL); + toku_mutex_init(toku_uninstrumented, &put_lock, nullptr); toku_os_recursive_delete(TOKU_TEST_FILENAME); - r = toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); - char logname[TOKU_PATH_MAX+1]; + r = toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU + S_IRWXG + S_IRWXO); + CKERR(r); + char logname[TOKU_PATH_MAX + 1]; r = toku_os_mkdir(toku_path_join(logname, 2, TOKU_TEST_FILENAME, "log"), S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = db_env_create(&env, 0); CKERR(r); diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc index eefc621f80ae464daee420f4efea6e80d36682f4..004a19eccec704c9c1367df7d19b8efb3435ee0e 100644 --- a/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc +++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-multiclient.cc @@ -303,13 +303,25 @@ static void test_indexer(DB *src, DB **dbs) r = indexer->set_poll_function(indexer, poll_print, NULL); CKERR(r); - // start threads doing additional inserts - no lock issues since indexer already created - r = toku_pthread_create(&client_threads[0], 0, client, (void *)&client_specs[0]); CKERR(r); - r = toku_pthread_create(&client_threads[1], 0, client, (void *)&client_specs[1]); CKERR(r); -// r = toku_pthread_create(&client_threads[2], 0, client, (void *)&client_specs[2]); CKERR(r); + // start threads doing additional inserts - no lock issues since indexer + // already created + r = toku_pthread_create(toku_uninstrumented, + &client_threads[0], + nullptr, + client, + static_cast(&client_specs[0])); + CKERR(r); + r = toku_pthread_create(toku_uninstrumented, + &client_threads[1], + nullptr, + client, + static_cast(&client_specs[1])); + CKERR(r); + // r = toku_pthread_create(toku_uninstrumented, &client_threads[2], 0, + // client, (void *)&client_specs[2]); CKERR(r); struct timeval start, now; - if ( verbose ) { + if (verbose) { printf("test_indexer build\n"); gettimeofday(&start,0); } diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc index 27501291b15de3fa96fd454146b44b4ba8b3e1db..f4dd9c53ed5386b9253b3efe20ca732d640098f7 100644 --- a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc +++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-abort.cc @@ -142,11 +142,14 @@ run_test(void) { } // run the indexer - struct indexer_arg indexer_arg = { env, src_db, 1, &dest_db }; + struct indexer_arg indexer_arg = {env, src_db, 1, &dest_db}; toku_pthread_t pid; - r = toku_pthread_create(&pid, NULL, indexer_thread, &indexer_arg); assert_zero(r); + r = toku_pthread_create( + toku_uninstrumented, &pid, nullptr, indexer_thread, &indexer_arg); + assert_zero(r); - r = txn->abort(txn); assert_zero(r); + r = txn->abort(txn); + assert_zero(r); void *ret; r = toku_pthread_join(pid, &ret); assert_zero(r); diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc index 59b40037125d452e0d3fbb9dcc0495e5da654ecb..99c9bf301ccb02a342ca6eda2e04c119b51f03bf 100644 --- a/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc +++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-put-commit.cc @@ -166,12 +166,16 @@ run_test(void) { } // run the indexer - struct indexer_arg indexer_arg = { env, src_db, 1, &dest_db }; + struct indexer_arg indexer_arg = {env, src_db, 1, &dest_db}; toku_pthread_t pid; - r = toku_pthread_create(&pid, NULL, indexer_thread, &indexer_arg); assert_zero(r); - - if (verbose) fprintf(stderr, "commit start\n"); - r = txn->commit(txn, 0); assert_zero(r); + r = toku_pthread_create( + toku_uninstrumented, &pid, nullptr, indexer_thread, &indexer_arg); + assert_zero(r); + + if (verbose) + fprintf(stderr, "commit start\n"); + r = txn->commit(txn, 0); + assert_zero(r); if (verbose) fprintf(stderr, "commit end\n"); void *ret; diff --git a/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc b/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc index a0be49c1617e48c761385d1040ae69010532f5d7..2bc60142f3c12732fabeb564422c3c3dcb4c4748 100644 --- a/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc +++ b/storage/tokudb/PerconaFT/src/tests/hotindexer-with-queries.cc @@ -114,10 +114,12 @@ static void query_only(DB *src) client_init(); // start thread doing query - r = toku_pthread_create(client_thread, 0, client, (void *)src); + r = toku_pthread_create( + toku_uninstrumented, client_thread, nullptr, + client, static_cast(src)); CKERR(r); - r = toku_pthread_join(*client_thread, &t0); + r = toku_pthread_join(*client_thread, &t0); CKERR(r); client_cleanup(); @@ -150,10 +152,13 @@ static void test_indexer(DB *src, DB **dbs) CKERR(r); // start thread doing query - r = toku_pthread_create(client_thread, 0, client, (void *)src); CKERR(r); + r = toku_pthread_create( + toku_uninstrumented, client_thread, nullptr, + client, static_cast(src)); + CKERR(r); struct timeval start, now; - if ( verbose ) { + if (verbose) { printf("test_indexer build\n"); gettimeofday(&start,0); } diff --git a/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc b/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc index b4874472bcb0080c429a073e19f0e11e71452dfb..e6c1b18b2b6ba3517a09795a1a7bd40bb51b5eb6 100644 --- a/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc +++ b/storage/tokudb/PerconaFT/src/tests/locktree_escalation_stalls.cc @@ -191,17 +191,22 @@ static void run_test(uint64_t max_i, int n_small) { env, big_db, max_i, big_test, }; toku_pthread_t big_id; - r = toku_pthread_create(&big_id, NULL, test_f, &big_test_args); + r = toku_pthread_create( + toku_uninstrumented, &big_id, nullptr, test_f, &big_test_args); assert(r == 0); struct test_args small_test_args[n_small]; toku_pthread_t small_id[n_small]; for (int i = 0; i < n_small; i++) { - small_test_args[i] = { env, small_db, max_i, small_test }; - r = toku_pthread_create(&small_id[i], NULL, test_f, &small_test_args[i]); + small_test_args[i] = {env, small_db, max_i, small_test}; + r = toku_pthread_create(toku_uninstrumented, + &small_id[i], + nullptr, + test_f, + &small_test_args[i]); assert(r == 0); } - + void *big_ret; r = toku_pthread_join(big_id, &big_ret); assert(r == 0); diff --git a/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h b/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h index 0ed68207ed4d7bf301b6480eb731cc85afcd5b9b..5c10d0cb712688d63dc9a45d6c931643a1ae37d5 100644 --- a/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h +++ b/storage/tokudb/PerconaFT/src/tests/recover-test_crash_in_flusher_thread.h @@ -70,13 +70,18 @@ static void *do_checkpoint_and_crash(void *arg) { static void flt_callback(int flt_state, void* extra) { cnt++; if (verbose) printf("flt_state!! %d\n", flt_state); - if (cnt > 0 && !starting_a_chkpt && flt_state == state_to_crash) { - starting_a_chkpt = true; - if (verbose) printf("flt_state %d\n", flt_state); - int r = toku_pthread_create(&checkpoint_tid, NULL, do_checkpoint_and_crash, extra); - assert(r==0); - usleep(2*1000*1000); - } + if (cnt > 0 && !starting_a_chkpt && flt_state == state_to_crash) { + starting_a_chkpt = true; + if (verbose) + printf("flt_state %d\n", flt_state); + int r = toku_pthread_create(toku_uninstrumented, + &checkpoint_tid, + nullptr, + do_checkpoint_and_crash, + extra); + assert(r == 0); + usleep(2 * 1000 * 1000); + } } diff --git a/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc b/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc index b1f5f98a90aa1b1967749623423b2149e790c511..1646030cc85c858c619ef86c62ac4afc04ccb7ee 100644 --- a/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc +++ b/storage/tokudb/PerconaFT/src/tests/recovery_stress.cc @@ -515,19 +515,8 @@ static void run_test (int iter) { // if requesting crash, randomly do other non-committed acts, then "drop_dead" if (iter > 0) { - if (verbose) printf("dying\n"); -#if 0 - // separate thread will perform random acts on other dictionaries (not 0) - r = toku_pthread_create(&thread, 0, random_acts, (void *) dictionaries); - CKERR(r); - // this thead will scribble over dictionary 0 before crash to verify that - // post-checkpoint inserts are not in the database - DB* db = dictionaries[0].db; - if (iter & 1) - scribble(db, iter); - else - thin_out(db, iter); -#endif + if (verbose) + printf("dying\n"); uint32_t delay = myrandom(); delay &= 0xFFF; // select lower 12 bits, shifted up 8 for random number ... delay = delay << 8; // ... uniformly distributed between 0 and 1M ... diff --git a/storage/tokudb/PerconaFT/src/tests/stress_openclose.h b/storage/tokudb/PerconaFT/src/tests/stress_openclose.h index 3f10bfe8aeb7e7bcb6594aa5240839ced9496432..3a55ca4486f2feca71a456c2b8076499e1f04382 100644 --- a/storage/tokudb/PerconaFT/src/tests/stress_openclose.h +++ b/storage/tokudb/PerconaFT/src/tests/stress_openclose.h @@ -245,19 +245,16 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) { // which they can choose a random db to either touch or query XMALLOC_N(num_buckets, buckets); for (int i = 0; i < num_buckets; i++) { - struct db_bucket bucket = { - .env = env, - .db = dbp[i], - .is_open = true - }; + struct db_bucket bucket = {.env = env, .db = dbp[i], .is_open = true}; buckets[i] = bucket; - toku_mutex_init(&buckets[i].mutex, NULL); + toku_mutex_init(toku_uninstrumented, &buckets[i].mutex, nullptr); } // run all of the query and update workers. they may randomly open // and close the dbs in each db_bucket to be some random dictionary, // so when they're done we'll have to clean up the mess so this // stress test can exit gracefully expecting db[i] = the ith db - //verbose_printf("stressing %d tables using %d update threads, %d query threads\n", + // verbose_printf("stressing %d tables using %d update threads, %d query + // threads\n", // num_buckets, update_threads, query_threads); verbose_printf("stressing %d tables using %d update threads\n", num_buckets, update_threads); diff --git a/storage/tokudb/PerconaFT/src/tests/test3039.cc b/storage/tokudb/PerconaFT/src/tests/test3039.cc index 54a2b3bf730781be84ad511e711709d5225a0a4a..6c38fa1359261810cadf8eb0857ba380c9dc1dc5 100644 --- a/storage/tokudb/PerconaFT/src/tests/test3039.cc +++ b/storage/tokudb/PerconaFT/src/tests/test3039.cc @@ -184,30 +184,36 @@ void do_threads (unsigned long long N, int do_nonlocal) { toku_pthread_t ths[2]; struct reader_thread_state rstates[2] = {{.elapsed_time = 0.0, .n_did_read = 0, - .n_to_read = (long long signed) N, - .do_local = 1, - .finish = 0}, + .n_to_read = (long long signed)N, + .do_local = 1, + .finish = 0}, {.elapsed_time = 0.0, .n_did_read = 0, .n_to_read = -1, - .do_local = 0, - .finish = 0}}; + .do_local = 0, + .finish = 0}}; int n_to_create = do_nonlocal ? 2 : 1; - for (int i=0; i(&rstates[i])); + CKERR(r); } - for (int i=0; i. + +---------------------------------------- + + PerconaFT is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License, version 3, + as published by the Free Software Foundation. + + PerconaFT 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 Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with PerconaFT. If not, see . +======= */ + +#ident \ + "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." + +#include "test.h" +// to verify the DB_LOCKING_READ works to lock the read rows for snapshot +// isolaton. +// we create a db, then init a read transaction with repeatable-read isolation +// and +// locking read flag, then we start another transaction to grab the write lock. +// DB_LOCKING_READ is defined here to just make the before and after tests work +// (before +// test did not have DB_LOCKING_READ flag). +#if !defined(DB_LOCKING_READ) +#define DB_LOCKING_READ 0 +#endif +static int prelock_range(DBC *cursor, int left, int right) { + DBT key_left; + dbt_init(&key_left, &left, sizeof left); + DBT key_right; + dbt_init(&key_right, &right, sizeof right); + int r = cursor->c_set_bounds(cursor, &key_left, &key_right, true, 0); + return r; +} + +static void test_read_write_range(DB_ENV *env, + DB *db, + uint32_t iso_flags, + int expect_r) { + int r; + + DB_TXN *txn_a = NULL; + r = env->txn_begin(env, NULL, &txn_a, iso_flags); + assert_zero(r); + DB_TXN *txn_b = NULL; + r = env->txn_begin(env, NULL, &txn_b, iso_flags); + assert_zero(r); + + DBC *cursor_a = NULL; + r = db->cursor(db, txn_a, &cursor_a, DB_LOCKING_READ); + assert_zero(r); + DBC *cursor_b = NULL; + r = db->cursor(db, txn_b, &cursor_b, DB_RMW); + assert_zero(r); + + r = prelock_range(cursor_a, htonl(10), htonl(100)); + assert_zero(r); + r = prelock_range(cursor_b, htonl(50), htonl(200)); + assert(r == expect_r); + + r = cursor_a->c_close(cursor_a); + assert_zero(r); + r = cursor_b->c_close(cursor_b); + assert_zero(r); + + r = txn_a->commit(txn_a, 0); + assert_zero(r); + r = txn_b->commit(txn_b, 0); + assert_zero(r); +} + +static void test_read_write_point(DB_ENV *env, + DB *db, + uint32_t iso_flags, + int expect_r) { + int r; + + DB_TXN *txn1 = NULL; + r = env->txn_begin(env, NULL, &txn1, iso_flags); + assert_zero(r); + + DB_TXN *txn2 = NULL; + r = env->txn_begin(env, NULL, &txn2, iso_flags); + assert_zero(r); + + DBC *c1 = NULL; + r = db->cursor(db, txn1, &c1, DB_LOCKING_READ); + assert_zero(r); + + DBC *c2 = NULL; + r = db->cursor(db, txn2, &c2, DB_RMW); + assert_zero(r); + + int k = htonl(42); + DBT key; + dbt_init(&key, &k, sizeof k); + DBT val; + memset(&val, 0, sizeof val); + r = c1->c_get(c1, &key, &val, DB_SET); + assert_zero(r); + + r = c2->c_get(c2, &key, &val, DB_SET); + assert(r == expect_r); + + r = c1->c_close(c1); + assert_zero(r); + r = c2->c_close(c2); + assert_zero(r); + + r = txn1->commit(txn1, 0); + assert_zero(r); + r = txn2->commit(txn2, 0); + assert_zero(r); +} + +int test_main(int argc, char *const argv[]) { + int r; + + const char *env_dir = TOKU_TEST_FILENAME; + const char *db_filename = "lockingreadtest"; + + parse_args(argc, argv); + + char rm_cmd[strlen(env_dir) + strlen("rm -rf ") + 1]; + snprintf(rm_cmd, sizeof(rm_cmd), "rm -rf %s", env_dir); + r = system(rm_cmd); + assert_zero(r); + + r = toku_os_mkdir(env_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + assert_zero(r); + + DB_ENV *env = NULL; + r = db_env_create(&env, 0); + assert_zero(r); + int env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | + DB_INIT_LOCK | DB_INIT_LOG; + r = env->open( + env, env_dir, env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + assert_zero(r); + + // create the db + DB *db = NULL; + r = db_create(&db, env, 0); + assert_zero(r); + DB_TXN *create_txn = NULL; + r = env->txn_begin(env, NULL, &create_txn, 0); + assert_zero(r); + r = db->open(db, + create_txn, + db_filename, + NULL, + DB_BTREE, + DB_CREATE, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + assert_zero(r); + r = create_txn->commit(create_txn, 0); + assert_zero(r); + + // add a record + + DB_TXN *write_txn = NULL; + r = env->txn_begin(env, NULL, &write_txn, 0); + assert_zero(r); + + int k = htonl(42); + int v = 42; + DBT key; + dbt_init(&key, &k, sizeof k); + DBT val; + dbt_init(&val, &v, sizeof v); + r = db->put(db, write_txn, &key, &val, DB_NOOVERWRITE); + assert_zero(r); + r = write_txn->commit(write_txn, 0); + assert_zero(r); + + test_read_write_range(env, db, DB_TXN_SNAPSHOT, DB_LOCK_NOTGRANTED); + test_read_write_point(env, db, DB_TXN_SNAPSHOT, DB_LOCK_NOTGRANTED); + + r = db->close(db, 0); + assert_zero(r); + + r = env->close(env, 0); + assert_zero(r); + return 0; +} diff --git a/storage/tokudb/PerconaFT/src/tests/test_3645.cc b/storage/tokudb/PerconaFT/src/tests/test_3645.cc index bb5566b032d4bf1443478913d6f18fe2f9dcc6cb..e1fa37bef54a897db524325672bd302fcafb42c1 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_3645.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_3645.cc @@ -239,33 +239,61 @@ test_evictions (void) { // make the forward fast scanner myargs[0].fast = true; myargs[0].fwd = true; - { int chk_r = toku_pthread_create(&mytids[0], NULL, scan_db, &myargs[0]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[0], nullptr, scan_db, &myargs[0]); + CKERR(chk_r); + } // make the forward slow scanner myargs[1].fast = false; myargs[1].fwd = true; - { int chk_r = toku_pthread_create(&mytids[1], NULL, scan_db, &myargs[1]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[1], nullptr, scan_db, &myargs[1]); + CKERR(chk_r); + } // make the backward fast scanner myargs[2].fast = true; myargs[2].fwd = false; - { int chk_r = toku_pthread_create(&mytids[2], NULL, scan_db, &myargs[2]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[2], nullptr, scan_db, &myargs[2]); + CKERR(chk_r); + } // make the backward slow scanner myargs[3].fast = false; myargs[3].fwd = false; - { int chk_r = toku_pthread_create(&mytids[3], NULL, scan_db, &myargs[3]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[3], nullptr, scan_db, &myargs[3]); + CKERR(chk_r); + } // make the guy that updates the db - { int chk_r = toku_pthread_create(&mytids[4], NULL, update_db, &myargs[4]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[4], nullptr, update_db, &myargs[4]); + CKERR(chk_r); + } // make the guy that does point queries - { int chk_r = toku_pthread_create(&mytids[5], NULL, ptquery_db, &myargs[5]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[5], nullptr, ptquery_db, &myargs[5]); + CKERR(chk_r); + } // make the guy that sleeps - { int chk_r = toku_pthread_create(&mytids[6], NULL, test_time, NULL); CKERR(chk_r); } - - for (uint32_t i = 0; i < sizeof(myargs)/sizeof(myargs[0]); i++) { + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &mytids[6], nullptr, test_time, nullptr); + CKERR(chk_r); + } + + for (uint32_t i = 0; i < sizeof(myargs) / sizeof(myargs[0]); i++) { void *ret; r = toku_pthread_join(mytids[i], &ret); assert_zero(r); } diff --git a/storage/tokudb/PerconaFT/src/tests/test_4015.cc b/storage/tokudb/PerconaFT/src/tests/test_4015.cc index dc18242b489e591f3d3151941b06850144cd0655..1231e3b4bca34837ba93e2dce389568cad50d87a 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_4015.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_4015.cc @@ -151,10 +151,18 @@ int test_main(int argc, char * const argv[]) { { int chk_r = db->open(db, NULL, "db", NULL, DB_BTREE, DB_CREATE, 0666); CKERR(chk_r); } DBT desc; dbt_init(&desc, "foo", sizeof("foo")); - IN_TXN_COMMIT(env, NULL, txn, 0, - { int chk_r = db->change_descriptor(db, txn, &desc, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); }); + IN_TXN_COMMIT(env, NULL, txn, 0, { + int chk_r = + db->change_descriptor(db, txn, &desc, DB_UPDATE_CMP_DESCRIPTOR); + CKERR(chk_r); + }); pthread_t thd; - { int chk_r = toku_pthread_create(&thd, NULL, startA, NULL); CKERR(chk_r); } + { + int chk_r = + toku_pthread_create( + toku_uninstrumented, &thd, nullptr, startA, nullptr); + CKERR(chk_r); + } startB(); diff --git a/storage/tokudb/PerconaFT/src/tests/test_abort1.cc b/storage/tokudb/PerconaFT/src/tests/test_abort1.cc index 55449610ffbe467c5ae418de0204a39889f4ae34..7b60364878baee1a629e8cd5ae5bd3bcce8f01f6 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_abort1.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_abort1.cc @@ -87,10 +87,12 @@ test_db_open_aborts (void) { CKERR2(r, DB_NOTFOUND); } toku_struct_stat statbuf; - char filename[TOKU_PATH_MAX+1]; - r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), &statbuf); - assert(r!=0); - assert(errno==ENOENT); + char filename[TOKU_PATH_MAX + 1]; + r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), + &statbuf, + toku_uninstrumented); + assert(r != 0); + assert(errno == ENOENT); } r=env->close(env, 0); assert(r==0); @@ -153,10 +155,12 @@ test_db_put_aborts (void) { CAST_FROM_VOIDP(filename, iname.data); assert(filename); } - toku_struct_stat statbuf; - char fullfile[TOKU_PATH_MAX+1]; - r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); - assert(r==0); + toku_struct_stat statbuf; + char fullfile[TOKU_PATH_MAX + 1]; + r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), + &statbuf, + toku_uninstrumented); + assert(r == 0); toku_free(filename); } // But the item should not be in it. diff --git a/storage/tokudb/PerconaFT/src/tests/test_abort4.cc b/storage/tokudb/PerconaFT/src/tests/test_abort4.cc index e67efb465b2d9c2124afb853a099bb3b7bf29b20..e797fc640d8192a7f88e4cfab6b3e6de73425bc8 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_abort4.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_abort4.cc @@ -160,10 +160,12 @@ verify_and_tear_down(int close_first) { CAST_FROM_VOIDP(filename, iname.data); assert(filename); } - toku_struct_stat statbuf; - char fullfile[TOKU_PATH_MAX+1]; - r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); - assert(r==0); + toku_struct_stat statbuf; + char fullfile[TOKU_PATH_MAX + 1]; + r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), + &statbuf, + toku_uninstrumented); + assert(r == 0); toku_free(filename); } CKERR(r); diff --git a/storage/tokudb/PerconaFT/src/tests/test_abort5.cc b/storage/tokudb/PerconaFT/src/tests/test_abort5.cc index 728afcce1b9c450e15b073392c67633d5e6469f9..d5d056d51268f44a2da2b879d084668363a67f92 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_abort5.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_abort5.cc @@ -191,10 +191,12 @@ verify_and_tear_down(int close_first) { CAST_FROM_VOIDP(filename, iname.data); assert(filename); } - toku_struct_stat statbuf; - char fullfile[TOKU_PATH_MAX+1]; - r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); - assert(r==0); + toku_struct_stat statbuf; + char fullfile[TOKU_PATH_MAX + 1]; + r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), + &statbuf, + toku_uninstrumented); + assert(r == 0); toku_free(filename); } if (close_first) { diff --git a/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc b/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc index 910cf46e5138779392cca0be90c2a227a47cd84e..766372a15c2820d3e4ba6065feb2070f6f3d4f9d 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_forkjoin.cc @@ -48,12 +48,13 @@ f (void *arg) { return arg; } -int -test_main(int argc, char *const argv[]) { +int test_main(int argc, char *const argv[]) { parse_args(argc, argv); toku_pthread_t t; - int r = toku_pthread_create(&t, 0, f, 0); assert(r == 0); + int r = toku_pthread_create(toku_uninstrumented, &t, nullptr, f, nullptr); + assert(r == 0); void *ret; - r = toku_pthread_join(t, &ret); assert(r == 0); + r = toku_pthread_join(t, &ret); + assert(r == 0); return 0; } diff --git a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc index 414ddd2b70af71f542052bf10e4a1dc6f994ca84..35104c2a569e5bb29fb953c70f73769d8fdf3ed4 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_count.cc @@ -87,12 +87,16 @@ test_groupcommit (int nthreads) { int i; toku_pthread_t threads[nthreads]; int whichthread[nthreads]; - for (i=0; iclose(db, 0); assert(r==0); diff --git a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc index 94eaf2a01a9de033796d8e827f1713421ed64b3c..6f872d10a32a389ef421bfdc2caf9a6f01014e4a 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_groupcommit_perf.cc @@ -84,12 +84,16 @@ test_groupcommit (int nthreads) { int i; toku_pthread_t threads[nthreads]; int whichthread[nthreads]; - for (i=0; itxn_begin(env, 0, &tid, 0); CKERR(r); diff --git a/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc b/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc index f2bf0a2c756d7459fedc452d96f8dec97e5ba315..66471a74af29159e436c17ecf33de8f8f99169ac 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_iterate_pending_lock_requests.cc @@ -112,12 +112,17 @@ int test_main(int UU(argc), char *const UU(argv[])) { acquire_lock(txn1, magic_key); acquire_lock_extra e1(txn2, magic_key); - r = toku_pthread_create(&thread1, NULL, acquire_lock_thread, &e1); CKERR(r); + r = toku_pthread_create( + toku_uninstrumented, &thread1, nullptr, acquire_lock_thread, &e1); + CKERR(r); acquire_lock_extra e2(txn3, magic_key); - r = toku_pthread_create(&thread2, NULL, acquire_lock_thread, &e2); CKERR(r); + r = toku_pthread_create( + toku_uninstrumented, &thread2, nullptr, acquire_lock_thread, &e2); + CKERR(r); sleep(1); - r = env->iterate_pending_lock_requests(env, iterate_callback, NULL); CKERR(r); + r = env->iterate_pending_lock_requests(env, iterate_callback, NULL); + CKERR(r); invariant(iterate_callback_called == 2); void *v; diff --git a/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc b/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc index 75ea49ec8583db6f8673da035b599db28e369ad2..571bae699169c6d3681b8a44ca4b920ce50745e4 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_lock_timeout_callback.cc @@ -118,7 +118,8 @@ int test_main(int UU(argc), char *const UU(argv[])) { acquire_lock(txn2, magic_key + 1); toku_pthread_t thread; acquire_lock_extra e(txn1, magic_key + 1); - r = toku_pthread_create(&thread, NULL, acquire_lock_thread, &e); + r = toku_pthread_create( + toku_uninstrumented, &thread, nullptr, acquire_lock_thread, &e); usleep(100000); acquire_lock(txn2, magic_key); invariant(callback_calls == 2); diff --git a/storage/tokudb/PerconaFT/src/tests/test_log1.cc b/storage/tokudb/PerconaFT/src/tests/test_log1.cc index 65fa1d830efeaefaf91fec005bfe25dd9abac263..5473a8e3d5e108b802c2af754caded476be2fbe6 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_log1.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_log1.cc @@ -87,10 +87,12 @@ static void make_db (bool close_env) { r=tid->commit(tid, 0); assert(r==0); r=db->close(db, 0); assert(r==0); { - toku_struct_stat statbuf; - char fullfile[TOKU_PATH_MAX+1]; - r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); - assert(r==0); + toku_struct_stat statbuf; + char fullfile[TOKU_PATH_MAX + 1]; + r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), + &statbuf, + toku_uninstrumented); + assert(r == 0); toku_free(filename); } if (close_env) { diff --git a/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc b/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc index 92c3657a1548bc529c2def6cf91e011b26b1a977..c66409fb8238768d6002f821b42e5b0952d858f2 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_log1_abort.cc @@ -80,11 +80,13 @@ test_main (int UU(argc), char UU(*const argv[])) { r=env->close(env, 0); assert(r==0); { - toku_struct_stat statbuf; - char filename[TOKU_PATH_MAX+1]; - r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), &statbuf); - assert(r==-1); - assert(errno==ENOENT); + toku_struct_stat statbuf; + char filename[TOKU_PATH_MAX + 1]; + r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), + &statbuf, + toku_uninstrumented); + assert(r == -1); + assert(errno == ENOENT); } return 0; } diff --git a/storage/tokudb/PerconaFT/src/tests/test_logmax.cc b/storage/tokudb/PerconaFT/src/tests/test_logmax.cc index e5de0a5d906b82bf720de3bafb47bb8231f5ef1f..133eb36ddb5a6d5fee794d8e1a590491f4066b81 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_logmax.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_logmax.cc @@ -50,14 +50,19 @@ check_logmax (int max) { struct dirent *ent; while ((ent=readdir(dir))) { if ((ent->d_type==DT_REG || ent->d_type==DT_UNKNOWN) && strncmp(ent->d_name, "log", 3)==0) { - // It is a "log*" file - char full_fname[TOKU_PATH_MAX+1]; - toku_struct_stat sbuf; - int r = toku_stat(toku_path_join(full_fname, 2, TOKU_TEST_FILENAME, ent->d_name), &sbuf); - assert(r==0); - if (verbose) - printf("%s is of size %" PRId64 "\n", ent->d_name, (int64_t)sbuf.st_size); - if (sbuf.st_size > max) any_too_big=1; + // It is a "log*" file + char full_fname[TOKU_PATH_MAX + 1]; + toku_struct_stat sbuf; + int r = toku_stat( + toku_path_join(full_fname, 2, TOKU_TEST_FILENAME, ent->d_name), + &sbuf, + toku_uninstrumented); + assert(r == 0); + if (verbose) + printf("%s is of size %" PRId64 "\n", + ent->d_name, + (int64_t)sbuf.st_size); + if (sbuf.st_size > max) any_too_big=1; } } assert(!any_too_big); diff --git a/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc b/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc index 66e9f4a5ec835331b5dd54b91364134f64379965..da53a7bfe1146d120ea3937793144ff383a30dba 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_multiple_checkpoints_block_commit.cc @@ -101,10 +101,17 @@ static void run_test(void) { toku_pthread_t chkpt1_tid; toku_pthread_t chkpt2_tid; - - { int chk_r = toku_pthread_create(&chkpt1_tid, NULL, run_checkpoint, NULL); CKERR(chk_r); } - { int chk_r = toku_pthread_create(&chkpt2_tid, NULL, run_checkpoint, NULL); CKERR(chk_r); } - usleep(2*1024*1024); + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &chkpt1_tid, nullptr, run_checkpoint, nullptr); + CKERR(chk_r); + } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &chkpt2_tid, nullptr, run_checkpoint, nullptr); + CKERR(chk_r); + } + usleep(2 * 1024 * 1024); struct timeval tstart; gettimeofday(&tstart, NULL); DB_TXN *txn = NULL; diff --git a/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc b/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc index e0bf0d2ec6f8aac321ade8ea94beeef547a2693c..6395f5916604786db732bbf7f6d15aff198a4757 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_stress_hot_indexing.cc @@ -312,12 +312,11 @@ stress_table(DB_ENV *env, DB **dbp, struct cli_args *cli_args) { run_workers(myargs, num_threads, cli_args->num_seconds, false, cli_args); } -int -test_main(int argc, char *const argv[]) { +int test_main(int argc, char *const argv[]) { gid_count = 0; memset(hi_gid, 0, sizeof(hi_gid)); - toku_mutex_init(&hi_lock, NULL); - toku_mutex_init(&fops_lock, NULL); + toku_mutex_init(toku_uninstrumented, &hi_lock, nullptr); + toku_mutex_init(toku_uninstrumented, &fops_lock, nullptr); hot_db = NULL; struct cli_args args = get_default_args(); // let's make default checkpointing period really slow diff --git a/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc b/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc index 0d5245e8f80558215c7cfcf9dea4f44961ce602f..a266de638f1d73827378c499e18704941d537b8c 100644 --- a/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc +++ b/storage/tokudb/PerconaFT/src/tests/test_thread_insert.cc @@ -150,10 +150,13 @@ test_main(int argc, char *const argv[]) { work[i].endno = n; } - if (verbose) printf("pid:%d\n", toku_os_getpid()); + if (verbose) + printf("pid:%d\n", toku_os_getpid()); - for (i=1; iclose(env, 0); assert(r == 0); diff --git a/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h b/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h index f2bacceed9d2fd528fdd17e73adef95c41049d00..e232f327d1065003e2bbcd79cf35d74437b16d8e 100644 --- a/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h +++ b/storage/tokudb/PerconaFT/src/tests/threaded_stress_test_helpers.h @@ -469,11 +469,11 @@ static int get_commit_flags(struct cli_args *args) { } struct worker_extra { - struct arg* thread_arg; + struct arg *thread_arg; toku_mutex_t *operation_lock_mutex; - struct rwlock *operation_lock; + struct st_rwlock *operation_lock; uint64_t *counters; - int64_t pad[4]; // pad to 64 bytes + int64_t pad[4]; // pad to 64 bytes }; static void lock_worker_op(struct worker_extra* we) { @@ -1772,11 +1772,12 @@ static int run_workers( ) { int r; - const struct perf_formatter *perf_formatter = &perf_formatters[cli_args->perf_output_format]; + const struct perf_formatter *perf_formatter = + &perf_formatters[cli_args->perf_output_format]; toku_mutex_t mutex = ZERO_MUTEX_INITIALIZER; - toku_mutex_init(&mutex, nullptr); - struct rwlock rwlock; - rwlock_init(&rwlock); + toku_mutex_init(toku_uninstrumented, &mutex, nullptr); + struct st_rwlock rwlock; + rwlock_init(toku_uninstrumented, &rwlock); toku_pthread_t tids[num_threads]; toku_pthread_t time_tid; if (cli_args->print_performance) { @@ -1798,15 +1799,26 @@ static int run_workers( worker_extra[i].thread_arg = &thread_args[i]; worker_extra[i].operation_lock = &rwlock; worker_extra[i].operation_lock_mutex = &mutex; - XCALLOC_N((int) NUM_OPERATION_TYPES, worker_extra[i].counters); + XCALLOC_N((int)NUM_OPERATION_TYPES, worker_extra[i].counters); TOKU_DRD_IGNORE_VAR(worker_extra[i].counters); - { int chk_r = toku_pthread_create(&tids[i], nullptr, worker, &worker_extra[i]); CKERR(chk_r); } + { + int chk_r = toku_pthread_create(toku_uninstrumented, + &tids[i], + nullptr, + worker, + &worker_extra[i]); + CKERR(chk_r); + } if (verbose) - printf("%lu created\n", (unsigned long) tids[i]); + printf("%lu created\n", (unsigned long)tids[i]); + } + { + int chk_r = toku_pthread_create( + toku_uninstrumented, &time_tid, nullptr, test_time, &tte); + CKERR(chk_r); } - { int chk_r = toku_pthread_create(&time_tid, nullptr, test_time, &tte); CKERR(chk_r); } if (verbose) - printf("%lu created\n", (unsigned long) time_tid); + printf("%lu created\n", (unsigned long)time_tid); void *ret; r = toku_pthread_join(time_tid, &ret); assert_zero(r); @@ -1817,17 +1829,22 @@ static int run_workers( // threads (i.e. there is some runaway thread). struct sleep_and_crash_extra sac_extra; ZERO_STRUCT(sac_extra); - toku_mutex_init(&sac_extra.mutex, nullptr); - toku_cond_init(&sac_extra.cond, nullptr); + toku_mutex_init(toku_uninstrumented, &sac_extra.mutex, nullptr); + toku_cond_init(toku_uninstrumented, &sac_extra.cond, nullptr); sac_extra.seconds = cli_args->join_timeout; sac_extra.is_setup = false; sac_extra.threads_have_joined = false; toku_mutex_lock(&sac_extra.mutex); toku_pthread_t sac_thread; - r = toku_pthread_create(&sac_thread, nullptr, sleep_and_crash, &sac_extra); + r = toku_pthread_create(toku_uninstrumented, + &sac_thread, + nullptr, + sleep_and_crash, + &sac_extra); assert_zero(r); - // Wait for sleep_and_crash thread to get set up, spinning is ok, this should be quick. + // Wait for sleep_and_crash thread to get set up, spinning is ok, this + // should be quick. while (!sac_extra.is_setup) { toku_mutex_unlock(&sac_extra.mutex); r = toku_pthread_yield(); diff --git a/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc b/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc index 30cc16d73a7c5840be15ff2d0234ee13c77799b0..469e78f492f1c7ab54d947c377e171b779fb89e5 100644 --- a/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc +++ b/storage/tokudb/PerconaFT/src/tests/txn_manager_handle_snapshot_atomicity.cc @@ -52,8 +52,8 @@ struct test_sync { static void test_sync_init(struct test_sync *UU(sync)) { #if TOKU_DEBUG_TXN_SYNC sync->state = 0; - toku_mutex_init(&sync->lock, NULL); - toku_cond_init(&sync->cv, NULL); + toku_mutex_init(toku_uninstrumented, &sync->lock, nullptr); + toku_cond_init(toku_uninstrumented, &sync->cv, nullptr); #endif } diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc index 1edfe9c81f9a592b02dc8066567e6065ec0fb536..41f48d4ec09bee97542879bae7702a1c8a8ecced 100644 --- a/storage/tokudb/PerconaFT/src/ydb.cc +++ b/storage/tokudb/PerconaFT/src/ydb.cc @@ -227,7 +227,7 @@ env_fs_poller(void *arg) { int in_red; // set true to prevent certain operations (returning ENOSPC) // get the fs sizes for the home dir - uint64_t avail_size, total_size; + uint64_t avail_size = 0, total_size = 0; r = toku_get_filesystem_sizes(env->i->dir, &avail_size, NULL, &total_size); assert(r == 0); in_yellow = (avail_size < 2 * env_fs_redzone(env, total_size)); @@ -643,7 +643,7 @@ static int validate_env(DB_ENV *env, path = toku_construct_full_name( 2, env->i->dir, toku_product_name_strings.environmentdictionary); assert(path); - r = toku_stat(path, &buf); + r = toku_stat(path, &buf, toku_uninstrumented); if (r == 0) { expect_newenv = false; // persistent info exists } else { @@ -668,7 +668,7 @@ static int validate_env(DB_ENV *env, path = toku_construct_full_name( 2, env->i->dir, toku_product_name_strings.rollback_cachefile); assert(path); - r = toku_stat(path, &buf); + r = toku_stat(path, &buf, toku_uninstrumented); if (r == 0) { if (expect_newenv) // rollback cachefile exists, but persistent env // is missing @@ -710,7 +710,7 @@ static int validate_env(DB_ENV *env, path = toku_construct_full_name( 2, env->i->dir, toku_product_name_strings.fileopsdirectory); assert(path); - r = toku_stat(path, &buf); + r = toku_stat(path, &buf, toku_uninstrumented); if (r == 0) { if (expect_newenv) // fileops directory exists, but persistent env // is missing @@ -856,10 +856,11 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) { // Verify that the home exists. toku_struct_stat buf; - r = toku_stat(home, &buf); + r = toku_stat(home, &buf, toku_uninstrumented); if (r != 0) { int e = get_error_errno(); - r = toku_ydb_do_error(env, e, "Error from toku_stat(\"%s\",...)\n", home); + r = toku_ydb_do_error( + env, e, "Error from toku_stat(\"%s\",...)\n", home); goto cleanup; } unused_flags &= ~DB_PRIVATE; @@ -875,13 +876,22 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) { env->i->open_flags = flags; env->i->open_mode = mode; + // Instrumentation probe start + TOKU_PROBE_START(toku_instr_probe_1); + env_setup_real_data_dir(env); env_setup_real_log_dir(env); env_setup_real_tmp_dir(env); - r = toku_single_process_lock(env->i->dir, "environment", &env->i->envdir_lockfd); - if (r!=0) goto cleanup; - r = toku_single_process_lock(env->i->real_data_dir, "data", &env->i->datadir_lockfd); + // Instrumentation probe stop + toku_instr_probe_1->stop(); + + r = toku_single_process_lock( + env->i->dir, "environment", &env->i->envdir_lockfd); + if (r != 0) + goto cleanup; + r = toku_single_process_lock( + env->i->real_data_dir, "data", &env->i->datadir_lockfd); if (r!=0) goto cleanup; r = toku_single_process_lock(env->i->real_log_dir, "logs", &env->i->logdir_lockfd); if (r!=0) goto cleanup; @@ -2931,7 +2941,8 @@ toku_env_create(DB_ENV ** envp, uint32_t flags) { result->i->open_dbs_by_dname->create(); XMALLOC(result->i->open_dbs_by_dict_id); result->i->open_dbs_by_dict_id->create(); - toku_pthread_rwlock_init(&result->i->open_dbs_rwlock, NULL); + toku_pthread_rwlock_init( + *result_i_open_dbs_rwlock_key, &result->i->open_dbs_rwlock, nullptr); *envp = result; r = 0; diff --git a/storage/tokudb/PerconaFT/src/ydb_db.cc b/storage/tokudb/PerconaFT/src/ydb_db.cc index 100d1bfa20b1409f4da7589f0a6fbbd6a3b9dd63..40c4a7f65772996ff752363d012821c39795a0e0 100644 --- a/storage/tokudb/PerconaFT/src/ydb_db.cc +++ b/storage/tokudb/PerconaFT/src/ydb_db.cc @@ -83,53 +83,56 @@ ydb_db_layer_get_status(YDB_DB_LAYER_STATUS statp) { *statp = ydb_db_layer_status; } -void create_iname_hint(const char *dname, char *hint) { +void create_iname_hint(DB_ENV *env, const char *dname, char *hint) { //Requires: size of hint array must be > strlen(dname) //Copy alphanumeric characters only. //Replace strings of non-alphanumeric characters with a single underscore. - bool underscored = false; - while (*dname) { - if (isalnum(*dname)) { - char c = *dname++; - *hint++ = c; - underscored = false; - } - else { - if (!underscored) - *hint++ = '_'; - dname++; - underscored = true; + if (env->get_dir_per_db(env) && !toku_os_is_absolute_name(dname)) { + assert(dname); + if (*dname == '.') + ++dname; + if (*dname == '/') + ++dname; + bool underscored = false; + bool dbdir_is_parsed = false; + // Do not change the first '/' because this is + // delimiter which splits name into database dir + // and table dir. + while (*dname) { + if (isalnum(*dname) || (*dname == '/' && !dbdir_is_parsed)) { + char c = *dname++; + *hint++ = c; + if (c == '/') + dbdir_is_parsed = true; + underscored = false; + } else if (!dbdir_is_parsed) { + char c = *dname++; + *hint++ = c; + } else { + if (!underscored) + *hint++ = '_'; + dname++; + underscored = true; + } } - } - *hint = '\0'; -} - -void create_iname_hint_for_dbdir(const char *dname, char *hint) { - assert(dname); - if (*dname == '.') - ++dname; - if (*dname == '/') - ++dname; - bool underscored = false; - bool dbdir_is_parsed = false; - // Do not change the first '/' because this is - // delimiter which splits name into database dir - // and table dir. - while (*dname) { - if (isalnum(*dname) || (*dname == '/' && !dbdir_is_parsed)) { - char c = *dname++; - *hint++ = c; - if (c == '/') - dbdir_is_parsed = true; - underscored = false; - } else { - if (!underscored) - *hint++ = '_'; - dname++; - underscored = true; + *hint = '\0'; + } else { + bool underscored = false; + while (*dname) { + if (isalnum(*dname)) { + char c = *dname++; + *hint++ = c; + underscored = false; + } + else { + if (!underscored) + *hint++ = '_'; + dname++; + underscored = true; + } } + *hint = '\0'; } - *hint = '\0'; } // n < 0 means to ignore mark and ignore n @@ -187,10 +190,7 @@ std::unique_ptr generate_iname_for_rename_or_open( } else if (is_open) id1 = toku_sync_fetch_and_add(&nontransactional_open_id, 1); - if (env->get_dir_per_db(env) && !toku_os_is_absolute_name(dname)) - create_iname_hint_for_dbdir(dname, hint); - else - create_iname_hint(dname, hint); + create_iname_hint(env, dname, hint); result.reset(create_iname(env, id1, id2, hint, NULL, -1)); @@ -1221,15 +1221,18 @@ load_inames(DB_ENV * env, DB_TXN * txn, int N, DB * dbs[/*N*/], const char * new for (i = 0; i < N; i++) { char * dname = dbs[i]->i->dname; toku_fill_dbt(&dname_dbt, dname, strlen(dname)+1); + // now create new iname char hint[strlen(dname) + 1]; - if (env->get_dir_per_db(env) && !toku_os_is_absolute_name(dname)) - create_iname_hint_for_dbdir(dname, hint); - else - create_iname_hint(dname, hint); - const char *new_iname = create_iname(env, xid.parent_id64, xid.child_id64, hint, mark, i); // allocates memory for iname_in_env + create_iname_hint(env, dname, hint); + + // allocates memory for iname_in_env + const char *new_iname = + create_iname(env, xid.parent_id64, xid.child_id64, hint, mark, i); new_inames_in_env[i] = new_iname; - toku_fill_dbt(&iname_dbt, new_iname, strlen(new_iname) + 1); // iname_in_env goes in directory + + // iname_in_env goes in directory + toku_fill_dbt(&iname_dbt, new_iname, strlen(new_iname) + 1); rval = toku_db_put(env->i->directory, txn, &dname_dbt, &iname_dbt, 0, true); if (rval) break; } diff --git a/storage/tokudb/PerconaFT/src/ydb_db.h b/storage/tokudb/PerconaFT/src/ydb_db.h index 8be28857c142b93273e50b258f5cce88e6209880..ab8fcd2a401f956dade144d6cfdfd8f78b43bcf6 100644 --- a/storage/tokudb/PerconaFT/src/ydb_db.h +++ b/storage/tokudb/PerconaFT/src/ydb_db.h @@ -122,8 +122,7 @@ toku_db_destruct_autotxn(DB_TXN *txn, int r, bool changed) { return r; } -void create_iname_hint_for_dbdir(const char *dname, char *hint); -void create_iname_hint(const char *dname, char *hint); +void create_iname_hint(DB_ENV *env, const char *dname, char *hint); char *create_iname(DB_ENV *env, uint64_t id1, uint64_t id2, diff --git a/storage/tokudb/PerconaFT/src/ydb_env_func.cc b/storage/tokudb/PerconaFT/src/ydb_env_func.cc index 13c56fec6bf7bc8dbb5c3f1ee2520698e30090b0..b8f0a63411619c4890ace79e60059be2c88d3905 100644 --- a/storage/tokudb/PerconaFT/src/ydb_env_func.cc +++ b/storage/tokudb/PerconaFT/src/ydb_env_func.cc @@ -109,7 +109,7 @@ void db_env_set_func_pread (ssize_t (*fun)(int, void *, size_t, off_t)) { } void db_env_set_func_loader_fwrite (size_t (*fwrite_fun)(const void*,size_t,size_t,FILE*)) { - ft_loader_set_os_fwrite(fwrite_fun); + toku_set_func_fwrite(fwrite_fun); } void db_env_set_func_malloc (void *(*f)(size_t)) { diff --git a/storage/tokudb/PerconaFT/src/ydb_txn.cc b/storage/tokudb/PerconaFT/src/ydb_txn.cc index 40b479055f22405d52ead69deca871ea7cfd333d..dd5fb3b8f0c78ae8d54b9b32723251b86b88be0b 100644 --- a/storage/tokudb/PerconaFT/src/ydb_txn.cc +++ b/storage/tokudb/PerconaFT/src/ydb_txn.cc @@ -540,10 +540,12 @@ int toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, uint32_t flags) { db_txn_struct_i(result)->iso = child_isolation; db_txn_struct_i(result)->lt_map.create_no_array(); - toku_mutex_init(&db_txn_struct_i(result)->txn_mutex, NULL); + toku_mutex_init(*db_txn_struct_i_txn_mutex_key, + &db_txn_struct_i(result)->txn_mutex, + nullptr); TXN_SNAPSHOT_TYPE snapshot_type; - switch(db_txn_struct_i(result)->iso){ + switch (db_txn_struct_i(result)->iso) { case(TOKU_ISO_SNAPSHOT): { snapshot_type = TXN_SNAPSHOT_ROOT; @@ -603,7 +605,9 @@ void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) { toku_txn_set_container_db_txn(tokutxn, result); - toku_mutex_init(&db_txn_struct_i(result)->txn_mutex, NULL); + toku_mutex_init(*db_txn_struct_i_txn_mutex_key, + &db_txn_struct_i(result)->txn_mutex, + nullptr); } // Test-only function diff --git a/storage/tokudb/PerconaFT/tools/CMakeLists.txt b/storage/tokudb/PerconaFT/tools/CMakeLists.txt index e6540bf69be5b2e25293d3bd4561e3461df40067..af40a838b9a81d820d8015a10d3cc8c25224433b 100644 --- a/storage/tokudb/PerconaFT/tools/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/tools/CMakeLists.txt @@ -12,6 +12,7 @@ foreach(tool ${tools}) (CMAKE_CXX_FLAGS_DEBUG MATCHES " -DENABLED_DEBUG_SYNC")) target_link_libraries(${tool} sql) endif() + target_link_libraries(${tool} mysqlclient) endif () add_space_separated_property(TARGET ${tool} COMPILE_FLAGS -fvisibility=hidden) diff --git a/storage/tokudb/PerconaFT/util/dbt.cc b/storage/tokudb/PerconaFT/util/dbt.cc index 5bc1cb7446f0100aab1bb44d1533d8d4dcaba2bf..b6d2a584a4551d9f6ba48e73ab8860af33aa8ef7 100644 --- a/storage/tokudb/PerconaFT/util/dbt.cc +++ b/storage/tokudb/PerconaFT/util/dbt.cc @@ -199,7 +199,8 @@ int toku_dbt_set(uint32_t len, const void *val, DBT *d, struct simple_dbt *sdbt) case (DB_DBT_MALLOC): d->data = NULL; d->ulen = 0; - //Fall through to DB_DBT_REALLOC + // fallthrough + // to DB_DBT_REALLOC case (DB_DBT_REALLOC): if (d->ulen < len) { d->ulen = len*2; diff --git a/storage/tokudb/PerconaFT/util/fmutex.h b/storage/tokudb/PerconaFT/util/fmutex.h index 9ff95978a168c8c30fddf801ea657b2dd1238166..fed1bc24a92b8817b1af9badb307521e07b4d87d 100644 --- a/storage/tokudb/PerconaFT/util/fmutex.h +++ b/storage/tokudb/PerconaFT/util/fmutex.h @@ -38,6 +38,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #pragma once +extern toku_instr_key *fmutex_cond_key; + // fair mutex struct fmutex { pthread_mutex_t mutex; @@ -98,8 +100,8 @@ void fmutex_lock(struct fmutex *fm) { } pthread_cond_t cond; - pthread_cond_init(&cond, NULL); - struct queue_item item = { .cond = &cond, .next = NULL }; + pthread_cond_init(*fmutex_cond_key, &cond, nullptr); + struct queue_item item = {.cond = &cond, .next = NULL}; enq_item(fm, &item); // Wait for our turn. diff --git a/storage/tokudb/PerconaFT/util/frwlock.cc b/storage/tokudb/PerconaFT/util/frwlock.cc index ce1e33e85d38287982c6ed42b9bc9e9610be44e5..1f821fe5f546aa60e6742c24c866e45c858e1c43 100644 --- a/storage/tokudb/PerconaFT/util/frwlock.cc +++ b/storage/tokudb/PerconaFT/util/frwlock.cc @@ -41,271 +41,311 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include #include +toku_instr_key *frwlock_m_wait_read_key; + namespace toku { -static __thread int thread_local_tid = -1; -static int get_local_tid() { - if (thread_local_tid == -1) { - thread_local_tid = toku_os_gettid(); - } - return thread_local_tid; -} - -void frwlock::init(toku_mutex_t *const mutex) { - m_mutex = mutex; - - m_num_readers = 0; - m_num_writers = 0; - m_num_want_write = 0; - m_num_want_read = 0; - m_num_signaled_readers = 0; - m_num_expensive_want_write = 0; - - toku_cond_init(&m_wait_read, nullptr); - m_queue_item_read.cond = &m_wait_read; - m_queue_item_read.next = nullptr; - m_wait_read_is_in_queue = false; - m_current_writer_expensive = false; - m_read_wait_expensive = false; - m_current_writer_tid = -1; - m_blocking_writer_context_id = CTX_INVALID; - - m_wait_head = nullptr; - m_wait_tail = nullptr; -} - -void frwlock::deinit(void) { - toku_cond_destroy(&m_wait_read); -} - -bool frwlock::queue_is_empty(void) const { - return m_wait_head == nullptr; -} - -void frwlock::enq_item(queue_item *const item) { - paranoid_invariant_null(item->next); - if (m_wait_tail != nullptr) { - m_wait_tail->next = item; - } else { - paranoid_invariant_null(m_wait_head); - m_wait_head = item; + static __thread int thread_local_tid = -1; + static int get_local_tid() { + if (thread_local_tid == -1) { + thread_local_tid = toku_os_gettid(); + } + return thread_local_tid; } - m_wait_tail = item; -} - -toku_cond_t *frwlock::deq_item(void) { - paranoid_invariant_notnull(m_wait_head); - paranoid_invariant_notnull(m_wait_tail); - queue_item *item = m_wait_head; - m_wait_head = m_wait_head->next; - if (m_wait_tail == item) { + + void frwlock::init(toku_mutex_t *const mutex +#if defined(TOKU_MYSQL_WITH_PFS) + , + const toku_instr_key &rwlock_instr_key +#endif + ) { + m_mutex = mutex; + + m_num_readers = 0; + m_num_writers = 0; + m_num_want_write = 0; + m_num_want_read = 0; + m_num_signaled_readers = 0; + m_num_expensive_want_write = 0; +#if defined(TOKU_MYSQL_WITH_PFS) + toku_pthread_rwlock_init(rwlock_instr_key, &m_rwlock, nullptr); +#endif + toku_cond_init(toku_uninstrumented, &m_wait_read, nullptr); + m_queue_item_read.cond = &m_wait_read; + m_queue_item_read.next = nullptr; + m_wait_read_is_in_queue = false; + m_current_writer_expensive = false; + m_read_wait_expensive = false; + m_current_writer_tid = -1; + m_blocking_writer_context_id = CTX_INVALID; + + m_wait_head = nullptr; m_wait_tail = nullptr; } - return item->cond; -} - -// Prerequisite: Holds m_mutex. -void frwlock::write_lock(bool expensive) { - toku_mutex_assert_locked(m_mutex); - if (this->try_write_lock(expensive)) { - return; + + void frwlock::deinit(void) { + toku_cond_destroy(&m_wait_read); +#if defined(TOKU_MYSQL_WITH_PFS) + toku_pthread_rwlock_destroy(&m_rwlock); +#endif } - toku_cond_t cond = TOKU_COND_INITIALIZER; - queue_item item = { .cond = &cond, .next = nullptr }; - this->enq_item(&item); + bool frwlock::queue_is_empty(void) const { return m_wait_head == nullptr; } - // Wait for our turn. - ++m_num_want_write; - if (expensive) { - ++m_num_expensive_want_write; - } - if (m_num_writers == 0 && m_num_want_write == 1) { - // We are the first to want a write lock. No new readers can get the lock. - // Set our thread id and context for proper instrumentation. - // see: toku_context_note_frwlock_contention() - m_current_writer_tid = get_local_tid(); - m_blocking_writer_context_id = toku_thread_get_context()->get_id(); - } - toku_cond_wait(&cond, m_mutex); - toku_cond_destroy(&cond); - - // Now it's our turn. - paranoid_invariant(m_num_want_write > 0); - paranoid_invariant_zero(m_num_readers); - paranoid_invariant_zero(m_num_writers); - paranoid_invariant_zero(m_num_signaled_readers); - - // Not waiting anymore; grab the lock. - --m_num_want_write; - if (expensive) { - --m_num_expensive_want_write; + void frwlock::enq_item(queue_item *const item) { + paranoid_invariant_null(item->next); + if (m_wait_tail != nullptr) { + m_wait_tail->next = item; + } else { + paranoid_invariant_null(m_wait_head); + m_wait_head = item; + } + m_wait_tail = item; } - m_num_writers = 1; - m_current_writer_expensive = expensive; - m_current_writer_tid = get_local_tid(); - m_blocking_writer_context_id = toku_thread_get_context()->get_id(); -} - -bool frwlock::try_write_lock(bool expensive) { - toku_mutex_assert_locked(m_mutex); - if (m_num_readers > 0 || m_num_writers > 0 || m_num_signaled_readers > 0 || m_num_want_write > 0) { - return false; + + toku_cond_t *frwlock::deq_item(void) { + paranoid_invariant_notnull(m_wait_head); + paranoid_invariant_notnull(m_wait_tail); + queue_item *item = m_wait_head; + m_wait_head = m_wait_head->next; + if (m_wait_tail == item) { + m_wait_tail = nullptr; + } + return item->cond; } - // No one holds the lock. Grant the write lock. - paranoid_invariant_zero(m_num_want_write); - paranoid_invariant_zero(m_num_want_read); - m_num_writers = 1; - m_current_writer_expensive = expensive; - m_current_writer_tid = get_local_tid(); - m_blocking_writer_context_id = toku_thread_get_context()->get_id(); - return true; -} - -void frwlock::read_lock(void) { - toku_mutex_assert_locked(m_mutex); - if (m_num_writers > 0 || m_num_want_write > 0) { - if (!m_wait_read_is_in_queue) { - // Throw the read cond_t onto the queue. - paranoid_invariant(m_num_signaled_readers == m_num_want_read); - m_queue_item_read.next = nullptr; - this->enq_item(&m_queue_item_read); - m_wait_read_is_in_queue = true; - paranoid_invariant(!m_read_wait_expensive); - m_read_wait_expensive = ( - m_current_writer_expensive || - (m_num_expensive_want_write > 0) - ); + + // Prerequisite: Holds m_mutex. + void frwlock::write_lock(bool expensive) { +#if defined(TOKU_MYSQL_WITH_PFS) + /* Instrumentation start */ + toku_rwlock_instrumentation rwlock_instr; + toku_instr_rwlock_wrlock_wait_start( + rwlock_instr, m_rwlock, __FILE__, __LINE__); +#endif + + toku_mutex_assert_locked(m_mutex); + if (this->try_write_lock(expensive)) { +#if defined(TOKU_MYSQL_WITH_PFS) + /* Instrumentation end */ + toku_instr_rwlock_wrlock_wait_end(rwlock_instr, 0); +#endif + return; } - // Note this contention event in engine status. - toku_context_note_frwlock_contention( - toku_thread_get_context()->get_id(), - m_blocking_writer_context_id - ); + toku_cond_t cond = TOKU_COND_INITIALIZER; + queue_item item = {.cond = &cond, .next = nullptr}; + this->enq_item(&item); // Wait for our turn. - ++m_num_want_read; - toku_cond_wait(&m_wait_read, m_mutex); + ++m_num_want_write; + if (expensive) { + ++m_num_expensive_want_write; + } + if (m_num_writers == 0 && m_num_want_write == 1) { + // We are the first to want a write lock. No new readers can get the + // lock. + // Set our thread id and context for proper instrumentation. + // see: toku_context_note_frwlock_contention() + m_current_writer_tid = get_local_tid(); + m_blocking_writer_context_id = toku_thread_get_context()->get_id(); + } + toku_cond_wait(&cond, m_mutex); + toku_cond_destroy(&cond); // Now it's our turn. + paranoid_invariant(m_num_want_write > 0); + paranoid_invariant_zero(m_num_readers); paranoid_invariant_zero(m_num_writers); - paranoid_invariant(m_num_want_read > 0); - paranoid_invariant(m_num_signaled_readers > 0); + paranoid_invariant_zero(m_num_signaled_readers); // Not waiting anymore; grab the lock. - --m_num_want_read; - --m_num_signaled_readers; + --m_num_want_write; + if (expensive) { + --m_num_expensive_want_write; + } + m_num_writers = 1; + m_current_writer_expensive = expensive; + m_current_writer_tid = get_local_tid(); + m_blocking_writer_context_id = toku_thread_get_context()->get_id(); + +#if defined(TOKU_MYSQL_WITH_PFS) + /* Instrumentation end */ + toku_instr_rwlock_wrlock_wait_end(rwlock_instr, 0); +#endif + } + + bool frwlock::try_write_lock(bool expensive) { + toku_mutex_assert_locked(m_mutex); + if (m_num_readers > 0 || m_num_writers > 0 || + m_num_signaled_readers > 0 || m_num_want_write > 0) { + return false; + } + // No one holds the lock. Grant the write lock. + paranoid_invariant_zero(m_num_want_write); + paranoid_invariant_zero(m_num_want_read); + m_num_writers = 1; + m_current_writer_expensive = expensive; + m_current_writer_tid = get_local_tid(); + m_blocking_writer_context_id = toku_thread_get_context()->get_id(); + return true; } - ++m_num_readers; -} -bool frwlock::try_read_lock(void) { - toku_mutex_assert_locked(m_mutex); - if (m_num_writers > 0 || m_num_want_write > 0) { - return false; + void frwlock::read_lock(void) { +#if defined(TOKU_MYSQL_WITH_PFS) + /* Instrumentation start */ + toku_rwlock_instrumentation rwlock_instr; + toku_instr_rwlock_rdlock_wait_start( + rwlock_instr, m_rwlock, __FILE__, __LINE__); +#endif + toku_mutex_assert_locked(m_mutex); + if (m_num_writers > 0 || m_num_want_write > 0) { + if (!m_wait_read_is_in_queue) { + // Throw the read cond_t onto the queue. + paranoid_invariant(m_num_signaled_readers == m_num_want_read); + m_queue_item_read.next = nullptr; + this->enq_item(&m_queue_item_read); + m_wait_read_is_in_queue = true; + paranoid_invariant(!m_read_wait_expensive); + m_read_wait_expensive = (m_current_writer_expensive || + (m_num_expensive_want_write > 0)); + } + + // Note this contention event in engine status. + toku_context_note_frwlock_contention( + toku_thread_get_context()->get_id(), + m_blocking_writer_context_id); + + // Wait for our turn. + ++m_num_want_read; + toku_cond_wait(&m_wait_read, m_mutex); + + // Now it's our turn. + paranoid_invariant_zero(m_num_writers); + paranoid_invariant(m_num_want_read > 0); + paranoid_invariant(m_num_signaled_readers > 0); + + // Not waiting anymore; grab the lock. + --m_num_want_read; + --m_num_signaled_readers; + } + ++m_num_readers; +#if defined(TOKU_MYSQL_WITH_PFS) + /* Instrumentation end */ + toku_instr_rwlock_rdlock_wait_end(rwlock_instr, 0); +#endif } - // No writer holds the lock. - // No writers are waiting. - // Grant the read lock. - ++m_num_readers; - return true; -} - -void frwlock::maybe_signal_next_writer(void) { - if (m_num_want_write > 0 && m_num_signaled_readers == 0 && m_num_readers == 0) { - toku_cond_t *cond = this->deq_item(); - paranoid_invariant(cond != &m_wait_read); - // Grant write lock to waiting writer. - paranoid_invariant(m_num_want_write > 0); - toku_cond_signal(cond); + + bool frwlock::try_read_lock(void) { + toku_mutex_assert_locked(m_mutex); + if (m_num_writers > 0 || m_num_want_write > 0) { + return false; + } + // No writer holds the lock. + // No writers are waiting. + // Grant the read lock. + ++m_num_readers; + return true; } -} - -void frwlock::read_unlock(void) { - toku_mutex_assert_locked(m_mutex); - paranoid_invariant(m_num_writers == 0); - paranoid_invariant(m_num_readers > 0); - --m_num_readers; - this->maybe_signal_next_writer(); -} - -bool frwlock::read_lock_is_expensive(void) { - toku_mutex_assert_locked(m_mutex); - if (m_wait_read_is_in_queue) { - return m_read_wait_expensive; + + void frwlock::maybe_signal_next_writer(void) { + if (m_num_want_write > 0 && m_num_signaled_readers == 0 && + m_num_readers == 0) { + toku_cond_t *cond = this->deq_item(); + paranoid_invariant(cond != &m_wait_read); + // Grant write lock to waiting writer. + paranoid_invariant(m_num_want_write > 0); + toku_cond_signal(cond); + } + } + + void frwlock::read_unlock(void) { +#ifdef TOKU_MYSQL_WITH_PFS + toku_instr_rwlock_unlock(m_rwlock); +#endif + toku_mutex_assert_locked(m_mutex); + paranoid_invariant(m_num_writers == 0); + paranoid_invariant(m_num_readers > 0); + --m_num_readers; + this->maybe_signal_next_writer(); } - else { - return m_current_writer_expensive || (m_num_expensive_want_write > 0); + + bool frwlock::read_lock_is_expensive(void) { + toku_mutex_assert_locked(m_mutex); + if (m_wait_read_is_in_queue) { + return m_read_wait_expensive; + } else { + return m_current_writer_expensive || + (m_num_expensive_want_write > 0); + } } -} + void frwlock::maybe_signal_or_broadcast_next(void) { + paranoid_invariant(m_num_signaled_readers == 0); -void frwlock::maybe_signal_or_broadcast_next(void) { - paranoid_invariant(m_num_signaled_readers == 0); + if (this->queue_is_empty()) { + paranoid_invariant(m_num_want_write == 0); + paranoid_invariant(m_num_want_read == 0); + return; + } + toku_cond_t *cond = this->deq_item(); + if (cond == &m_wait_read) { + // Grant read locks to all waiting readers + paranoid_invariant(m_wait_read_is_in_queue); + paranoid_invariant(m_num_want_read > 0); + m_num_signaled_readers = m_num_want_read; + m_wait_read_is_in_queue = false; + m_read_wait_expensive = false; + toku_cond_broadcast(cond); + } else { + // Grant write lock to waiting writer. + paranoid_invariant(m_num_want_write > 0); + toku_cond_signal(cond); + } + } - if (this->queue_is_empty()) { - paranoid_invariant(m_num_want_write == 0); - paranoid_invariant(m_num_want_read == 0); - return; + void frwlock::write_unlock(void) { +#if defined(TOKU_MYSQL_WITH_PFS) + toku_instr_rwlock_unlock(m_rwlock); +#endif + toku_mutex_assert_locked(m_mutex); + paranoid_invariant(m_num_writers == 1); + m_num_writers = 0; + m_current_writer_expensive = false; + m_current_writer_tid = -1; + m_blocking_writer_context_id = CTX_INVALID; + this->maybe_signal_or_broadcast_next(); } - toku_cond_t *cond = this->deq_item(); - if (cond == &m_wait_read) { - // Grant read locks to all waiting readers - paranoid_invariant(m_wait_read_is_in_queue); - paranoid_invariant(m_num_want_read > 0); - m_num_signaled_readers = m_num_want_read; - m_wait_read_is_in_queue = false; - m_read_wait_expensive = false; - toku_cond_broadcast(cond); + bool frwlock::write_lock_is_expensive(void) { + toku_mutex_assert_locked(m_mutex); + return (m_num_expensive_want_write > 0) || (m_current_writer_expensive); } - else { - // Grant write lock to waiting writer. - paranoid_invariant(m_num_want_write > 0); - toku_cond_signal(cond); + + uint32_t frwlock::users(void) const { + toku_mutex_assert_locked(m_mutex); + return m_num_readers + m_num_writers + m_num_want_read + + m_num_want_write; + } + uint32_t frwlock::blocked_users(void) const { + toku_mutex_assert_locked(m_mutex); + return m_num_want_read + m_num_want_write; + } + uint32_t frwlock::writers(void) const { + // this is sometimes called as "assert(lock->writers())" when we + // assume we have the write lock. if that's the assumption, we may + // not own the mutex, so we don't assert_locked here + return m_num_writers; + } + uint32_t frwlock::blocked_writers(void) const { + toku_mutex_assert_locked(m_mutex); + return m_num_want_write; + } + uint32_t frwlock::readers(void) const { + toku_mutex_assert_locked(m_mutex); + return m_num_readers; + } + uint32_t frwlock::blocked_readers(void) const { + toku_mutex_assert_locked(m_mutex); + return m_num_want_read; } -} - -void frwlock::write_unlock(void) { - toku_mutex_assert_locked(m_mutex); - paranoid_invariant(m_num_writers == 1); - m_num_writers = 0; - m_current_writer_expensive = false; - m_current_writer_tid = -1; - m_blocking_writer_context_id = CTX_INVALID; - this->maybe_signal_or_broadcast_next(); -} -bool frwlock::write_lock_is_expensive(void) { - toku_mutex_assert_locked(m_mutex); - return (m_num_expensive_want_write > 0) || (m_current_writer_expensive); -} - - -uint32_t frwlock::users(void) const { - toku_mutex_assert_locked(m_mutex); - return m_num_readers + m_num_writers + m_num_want_read + m_num_want_write; -} -uint32_t frwlock::blocked_users(void) const { - toku_mutex_assert_locked(m_mutex); - return m_num_want_read + m_num_want_write; -} -uint32_t frwlock::writers(void) const { - // this is sometimes called as "assert(lock->writers())" when we - // assume we have the write lock. if that's the assumption, we may - // not own the mutex, so we don't assert_locked here - return m_num_writers; -} -uint32_t frwlock::blocked_writers(void) const { - toku_mutex_assert_locked(m_mutex); - return m_num_want_write; -} -uint32_t frwlock::readers(void) const { - toku_mutex_assert_locked(m_mutex); - return m_num_readers; -} -uint32_t frwlock::blocked_readers(void) const { - toku_mutex_assert_locked(m_mutex); - return m_num_want_read; -} } // namespace toku diff --git a/storage/tokudb/PerconaFT/util/frwlock.h b/storage/tokudb/PerconaFT/util/frwlock.h index 52b98a8d727ca302d4af8f799b232f137654cf47..b02d95e545cb860fd7f1150128df87d8243dbe50 100644 --- a/storage/tokudb/PerconaFT/util/frwlock.h +++ b/storage/tokudb/PerconaFT/util/frwlock.h @@ -48,76 +48,82 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. namespace toku { -class frwlock { -public: - - void init(toku_mutex_t *const mutex); - void deinit(void); - - void write_lock(bool expensive); - bool try_write_lock(bool expensive); - void write_unlock(void); - // returns true if acquiring a write lock will be expensive - bool write_lock_is_expensive(void); - - void read_lock(void); - bool try_read_lock(void); - void read_unlock(void); - // returns true if acquiring a read lock will be expensive - bool read_lock_is_expensive(void); - - uint32_t users(void) const; - uint32_t blocked_users(void) const; - uint32_t writers(void) const; - uint32_t blocked_writers(void) const; - uint32_t readers(void) const; - uint32_t blocked_readers(void) const; - -private: - struct queue_item { - toku_cond_t *cond; - struct queue_item *next; + class frwlock { + public: + void init(toku_mutex_t *const mutex +#if defined(TOKU_MYSQL_WITH_PFS) + , + const toku_instr_key &rwlock_instr_key +#endif + ); + void deinit(void); + + void write_lock(bool expensive); + bool try_write_lock(bool expensive); + void write_unlock(void); + // returns true if acquiring a write lock will be expensive + bool write_lock_is_expensive(void); + + void read_lock(void); + bool try_read_lock(void); + void read_unlock(void); + // returns true if acquiring a read lock will be expensive + bool read_lock_is_expensive(void); + + uint32_t users(void) const; + uint32_t blocked_users(void) const; + uint32_t writers(void) const; + uint32_t blocked_writers(void) const; + uint32_t readers(void) const; + uint32_t blocked_readers(void) const; + + private: + struct queue_item { + toku_cond_t *cond; + struct queue_item *next; + }; + + bool queue_is_empty(void) const; + void enq_item(queue_item *const item); + toku_cond_t *deq_item(void); + void maybe_signal_or_broadcast_next(void); + void maybe_signal_next_writer(void); + + toku_mutex_t *m_mutex; + + uint32_t m_num_readers; + uint32_t m_num_writers; + uint32_t m_num_want_write; + uint32_t m_num_want_read; + uint32_t m_num_signaled_readers; + // number of writers waiting that are expensive + // MUST be < m_num_want_write + uint32_t m_num_expensive_want_write; + // bool that states if the current writer is expensive + // if there is no current writer, then is false + bool m_current_writer_expensive; + // bool that states if waiting for a read + // is expensive + // if there are currently no waiting readers, then set to false + bool m_read_wait_expensive; + // thread-id of the current writer + int m_current_writer_tid; + // context id describing the context of the current writer blocking + // new readers (either because this writer holds the write lock or + // is the first to want the write lock). + context_id m_blocking_writer_context_id; + queue_item m_queue_item_read; + bool m_wait_read_is_in_queue; + + toku_cond_t m_wait_read; +#if defined(TOKU_MYSQL_WITH_PFS) + toku_pthread_rwlock_t m_rwlock; +#endif + queue_item *m_wait_head; + queue_item *m_wait_tail; }; - bool queue_is_empty(void) const; - void enq_item(queue_item *const item); - toku_cond_t *deq_item(void); - void maybe_signal_or_broadcast_next(void); - void maybe_signal_next_writer(void); - - toku_mutex_t *m_mutex; - - uint32_t m_num_readers; - uint32_t m_num_writers; - uint32_t m_num_want_write; - uint32_t m_num_want_read; - uint32_t m_num_signaled_readers; - // number of writers waiting that are expensive - // MUST be < m_num_want_write - uint32_t m_num_expensive_want_write; - // bool that states if the current writer is expensive - // if there is no current writer, then is false - bool m_current_writer_expensive; - // bool that states if waiting for a read - // is expensive - // if there are currently no waiting readers, then set to false - bool m_read_wait_expensive; - // thread-id of the current writer - int m_current_writer_tid; - // context id describing the context of the current writer blocking - // new readers (either because this writer holds the write lock or - // is the first to want the write lock). - context_id m_blocking_writer_context_id; - - toku_cond_t m_wait_read; - queue_item m_queue_item_read; - bool m_wait_read_is_in_queue; - - queue_item *m_wait_head; - queue_item *m_wait_tail; -}; - -ENSURE_POD(frwlock); + ENSURE_POD(frwlock); } // namespace toku diff --git a/storage/tokudb/PerconaFT/util/kibbutz.cc b/storage/tokudb/PerconaFT/util/kibbutz.cc index 7fc24bae7275bb0e146611a70303f89bdc5f2beb..409bf6bdd7ba656bf674259ede2ce68900312dda 100644 --- a/storage/tokudb/PerconaFT/util/kibbutz.cc +++ b/storage/tokudb/PerconaFT/util/kibbutz.cc @@ -72,14 +72,18 @@ struct kibbutz { uint64_t total_execution_time; }; -static void *work_on_kibbutz (void *); +static void *work_on_kibbutz(void *); -int toku_kibbutz_create (int n_workers, KIBBUTZ *kb_ret) { +toku_instr_key *kibbutz_mutex_key; +toku_instr_key *kibbutz_k_cond_key; +toku_instr_key *kibbutz_thread_key; + +int toku_kibbutz_create(int n_workers, KIBBUTZ *kb_ret) { int r = 0; *kb_ret = NULL; KIBBUTZ XCALLOC(k); - toku_mutex_init(&k->mutex, NULL); - toku_cond_init(&k->cond, NULL); + toku_mutex_init(*kibbutz_mutex_key, &k->mutex, nullptr); + toku_cond_init(*kibbutz_k_cond_key, &k->cond, nullptr); k->please_shutdown = false; k->head = NULL; k->tail = NULL; @@ -93,7 +97,11 @@ int toku_kibbutz_create (int n_workers, KIBBUTZ *kb_ret) { XMALLOC_N(n_workers, k->ids); for (int i = 0; i < n_workers; i++) { k->ids[i].k = k; - r = toku_pthread_create(&k->workers[i], NULL, work_on_kibbutz, &k->ids[i]); + r = toku_pthread_create(*kibbutz_thread_key, + &k->workers[i], + nullptr, + work_on_kibbutz, + &k->ids[i]); if (r != 0) { k->n_workers = i; toku_kibbutz_destroy(k); @@ -153,10 +161,14 @@ static void *work_on_kibbutz (void *kidv) { // if there's another item on k->head, then we'll just go grab it now, without waiting for a signal. } if (k->please_shutdown) { - // Don't follow this unless the work is all done, so that when we set please_shutdown, all the work finishes before any threads quit. - ksignal(k); // must wake up anyone else who is waiting, so they can shut down. + // Don't follow this unless the work is all done, so that when we + // set please_shutdown, all the work finishes before any threads + // quit. + ksignal(k); // must wake up anyone else who is waiting, so they can + // shut down. kunlock(k); - return NULL; + toku_instr_delete_current_thread(); + return nullptr; } // There is no work to do and it's not time to shutdown, so wait. kwait(k); diff --git a/storage/tokudb/PerconaFT/util/minicron.cc b/storage/tokudb/PerconaFT/util/minicron.cc index 737c6ef6a4fc1ba1d8f4929b0390a3a0eecdf65b..c1412015be073e635e11a86c81104a7624bfeb88 100644 --- a/storage/tokudb/PerconaFT/util/minicron.cc +++ b/storage/tokudb/PerconaFT/util/minicron.cc @@ -43,8 +43,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "portability/toku_assert.h" #include "util/minicron.h" -static void -toku_gettime (toku_timespec_t *a) { +toku_instr_key *minicron_p_mutex_key; +toku_instr_key *minicron_p_condvar_key; +toku_instr_key *minicron_thread_key; + +static void toku_gettime(toku_timespec_t *a) { struct timeval tv; gettimeofday(&tv, 0); a->tv_sec = tv.tv_sec; @@ -74,7 +77,8 @@ minicron_do (void *pv) while (1) { if (p->do_shutdown) { toku_mutex_unlock(&p->mutex); - return 0; + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); } if (p->period_in_ms == 0) { // if we aren't supposed to do it then just do an untimed wait. @@ -104,7 +108,8 @@ minicron_do (void *pv) // Now we woke up, and we should figure out what to do if (p->do_shutdown) { toku_mutex_unlock(&p->mutex); - return 0; + toku_instr_delete_current_thread(); + return toku_pthread_done(nullptr); } if (p->period_in_ms > 1000) { toku_timespec_t now; @@ -137,17 +142,17 @@ toku_minicron_setup(struct minicron *p, uint32_t period_in_ms, int(*f)(void *), p->f = f; p->arg = arg; toku_gettime(&p->time_of_last_call_to_f); - //printf("now=%.6f", p->time_of_last_call_to_f.tv_sec + p->time_of_last_call_to_f.tv_nsec*1e-9); - p->period_in_ms = period_in_ms; + // printf("now=%.6f", p->time_of_last_call_to_f.tv_sec + + // p->time_of_last_call_to_f.tv_nsec*1e-9); + p->period_in_ms = period_in_ms; p->do_shutdown = false; - toku_mutex_init(&p->mutex, 0); - toku_cond_init (&p->condvar, 0); - return toku_pthread_create(&p->thread, 0, minicron_do, p); + toku_mutex_init(*minicron_p_mutex_key, &p->mutex, nullptr); + toku_cond_init(*minicron_p_condvar_key, &p->condvar, nullptr); + return toku_pthread_create( + *minicron_thread_key, &p->thread, nullptr, minicron_do, p); } - -void -toku_minicron_change_period(struct minicron *p, uint32_t new_period) -{ + +void toku_minicron_change_period(struct minicron *p, uint32_t new_period) { toku_mutex_lock(&p->mutex); p->period_in_ms = new_period; toku_cond_signal(&p->condvar); diff --git a/storage/tokudb/PerconaFT/util/nb_mutex.h b/storage/tokudb/PerconaFT/util/nb_mutex.h index 3490c1b365ca8ed66d49bd6d665e76b502f3d5fe..d777961ad782159aabb6b8c49673e1f6008bde8f 100644 --- a/storage/tokudb/PerconaFT/util/nb_mutex.h +++ b/storage/tokudb/PerconaFT/util/nb_mutex.h @@ -49,35 +49,67 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. // increase parallelism at the expense of single thread performance, we // are experimenting with a single higher level lock. +extern toku_instr_key *nb_mutex_key; + typedef struct nb_mutex *NB_MUTEX; struct nb_mutex { - struct rwlock lock; + struct st_rwlock lock; +#if defined(TOKU_MYSQL_WITH_PFS) + toku_mutex_t toku_mutex; +#endif }; +#if defined(TOKU_MYSQL_WITH_PFS) +#define nb_mutex_init(MK, RK, M) \ + inline_nb_mutex_init(MK, RK, M) +#else +#define nb_mutex_init(MK, RK, M) inline_nb_mutex_init(M) +#endif + // initialize an nb mutex -static __attribute__((__unused__)) -void -nb_mutex_init(NB_MUTEX nb_mutex) { - rwlock_init(&nb_mutex->lock); +inline void inline_nb_mutex_init( +#if defined(TOKU_MYSQL_WITH_PFS) + const toku_instr_key &mutex_instr_key, + const toku_instr_key &rwlock_instr_key, +#endif + NB_MUTEX nb_mutex) { +#if defined(TOKU_MYSQL_WITH_PFS) + toku_mutex_init(mutex_instr_key, &nb_mutex->toku_mutex, nullptr); +#endif + rwlock_init(rwlock_instr_key, &nb_mutex->lock); } // destroy a read write lock -static __attribute__((__unused__)) -void -nb_mutex_destroy(NB_MUTEX nb_mutex) { +inline void nb_mutex_destroy(NB_MUTEX nb_mutex) { +#if defined(TOKU_MYSQL_WITH_PFS) + toku_instr_mutex_destroy(nb_mutex->toku_mutex.psi_mutex); +#endif rwlock_destroy(&nb_mutex->lock); } // obtain a write lock // expects: mutex is locked -static inline void nb_mutex_lock(NB_MUTEX nb_mutex, toku_mutex_t *mutex) { +inline void nb_mutex_lock(NB_MUTEX nb_mutex, toku_mutex_t *mutex) { +#ifdef TOKU_MYSQL_WITH_PFS + toku_mutex_instrumentation mutex_instr; + toku_instr_mutex_lock_start(mutex_instr, + *mutex, + __FILE__, + __LINE__); // TODO: pull these to caller? +#endif rwlock_write_lock(&nb_mutex->lock, mutex); +#if defined(TOKU_MYSQL_WITH_PFS) + toku_instr_mutex_lock_end(mutex_instr, 0); +#endif } // release a write lock // expects: mutex is locked -static inline void nb_mutex_unlock(NB_MUTEX nb_mutex) { +inline void nb_mutex_unlock(NB_MUTEX nb_mutex) { +#if defined(TOKU_MYSQL_WITH_PFS) + toku_instr_mutex_unlock(nb_mutex->toku_mutex.psi_mutex); +#endif rwlock_write_unlock(&nb_mutex->lock); } diff --git a/storage/tokudb/PerconaFT/util/queue.cc b/storage/tokudb/PerconaFT/util/queue.cc index 0716dfb2f59448d17ad76af5ebee4c944970bce8..39dfbbc699a62a492913a798c12e2d1883d156d3 100644 --- a/storage/tokudb/PerconaFT/util/queue.cc +++ b/storage/tokudb/PerconaFT/util/queue.cc @@ -44,6 +44,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "memory.h" #include +toku_instr_key *queue_result_mutex_key; +toku_instr_key *queue_result_cond_key; + struct qitem; struct qitem { @@ -81,11 +84,11 @@ int toku_queue_create (QUEUE *q, uint64_t weight_limit) if (result==NULL) return get_error_errno(); result->contents_weight = 0; result->weight_limit = weight_limit; - result->head = NULL; - result->tail = NULL; - result->eof = false; - toku_mutex_init(&result->mutex, NULL); - toku_cond_init(&result->cond, NULL); + result->head = NULL; + result->tail = NULL; + result->eof = false; + toku_mutex_init(*queue_result_mutex_key, &result->mutex, nullptr); + toku_cond_init(*queue_result_cond_key, &result->cond, nullptr); *q = result; return 0; } diff --git a/storage/tokudb/PerconaFT/util/rwlock.h b/storage/tokudb/PerconaFT/util/rwlock.h index 47f78df70d1cf54900f4d465f5d564fe52035758..d9a13ba9014296f69e25fa194f348d5a6942f3af 100644 --- a/storage/tokudb/PerconaFT/util/rwlock.h +++ b/storage/tokudb/PerconaFT/util/rwlock.h @@ -39,6 +39,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #pragma once #include +#include +#include /* Readers/writers locks implementation * @@ -147,53 +149,81 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. // increase parallelism at the expense of single thread performance, we // are experimenting with a single higher level lock. -typedef struct rwlock *RWLOCK; -struct rwlock { - int reader; // the number of readers - int want_read; // the number of blocked readers +extern toku_instr_key *rwlock_cond_key; +extern toku_instr_key *rwlock_wait_read_key; +extern toku_instr_key *rwlock_wait_write_key; + +typedef struct st_rwlock *RWLOCK; +struct st_rwlock { + int reader; // the number of readers + int want_read; // the number of blocked readers toku_cond_t wait_read; int writer; // the number of writers int want_write; // the number of blocked writers toku_cond_t wait_write; - toku_cond_t* wait_users_go_to_zero; + toku_cond_t *wait_users_go_to_zero; +#if defined(TOKU_MYSQL_WITH_PFS) + toku_pthread_rwlock_t prwlock; +#endif }; // returns: the sum of the number of readers, pending readers, writers, and // pending writers static inline int rwlock_users(RWLOCK rwlock) { - return rwlock->reader + rwlock->want_read + rwlock->writer + rwlock->want_write; + return rwlock->reader + rwlock->want_read + rwlock->writer + + rwlock->want_write; } -// initialize a read write lock +#if defined(TOKU_MYSQL_WITH_PFS) +#define rwlock_init(K, R) inline_rwlock_init(K, R) +#else +#define rwlock_init(K, R) inline_rwlock_init(R) +#endif -static __attribute__((__unused__)) -void -rwlock_init(RWLOCK rwlock) { +// initialize a read write lock +static inline __attribute__((__unused__)) void inline_rwlock_init( +#if defined(TOKU_MYSQL_WITH_PFS) + const toku_instr_key &rwlock_instr_key, +#endif + RWLOCK rwlock) { +#if defined(TOKU_MYSQL_WITH_PFS) + toku_pthread_rwlock_init(rwlock_instr_key, &rwlock->prwlock, nullptr); +#endif rwlock->reader = rwlock->want_read = 0; - toku_cond_init(&rwlock->wait_read, 0); rwlock->writer = rwlock->want_write = 0; - toku_cond_init(&rwlock->wait_write, 0); + toku_cond_init(toku_uninstrumented, &rwlock->wait_read, nullptr); + toku_cond_init(toku_uninstrumented, &rwlock->wait_write, nullptr); rwlock->wait_users_go_to_zero = NULL; } // destroy a read write lock -static __attribute__((__unused__)) -void -rwlock_destroy(RWLOCK rwlock) { +static inline __attribute__((__unused__)) void rwlock_destroy(RWLOCK rwlock) { paranoid_invariant(rwlock->reader == 0); paranoid_invariant(rwlock->want_read == 0); paranoid_invariant(rwlock->writer == 0); paranoid_invariant(rwlock->want_write == 0); toku_cond_destroy(&rwlock->wait_read); toku_cond_destroy(&rwlock->wait_write); +#if defined(TOKU_MYSQL_WITH_PFS) + toku_pthread_rwlock_destroy(&rwlock->prwlock); +#endif } // obtain a read lock // expects: mutex is locked static inline void rwlock_read_lock(RWLOCK rwlock, toku_mutex_t *mutex) { +#ifdef TOKU_MYSQL_WITH_PFS + /* Instrumentation start */ + toku_rwlock_instrumentation rwlock_instr; + // TODO: pull location information up to caller + toku_instr_rwlock_rdlock_wait_start( + rwlock_instr, rwlock->prwlock, __FILE__, __LINE__); + +#endif + paranoid_invariant(!rwlock->wait_users_go_to_zero); if (rwlock->writer || rwlock->want_write) { rwlock->want_read++; @@ -203,12 +233,19 @@ static inline void rwlock_read_lock(RWLOCK rwlock, toku_mutex_t *mutex) { rwlock->want_read--; } rwlock->reader++; +#ifdef TOKU_MYSQL_WITH_PFS + /* Instrumentation end */ + toku_instr_rwlock_wrlock_wait_end(rwlock_instr, 0); +#endif } // release a read lock // expects: mutex is locked static inline void rwlock_read_unlock(RWLOCK rwlock) { +#ifdef TOKU_MYSQL_WITH_PFS + toku_instr_rwlock_unlock(rwlock->prwlock); +#endif paranoid_invariant(rwlock->reader > 0); paranoid_invariant(rwlock->writer == 0); rwlock->reader--; @@ -224,6 +261,12 @@ static inline void rwlock_read_unlock(RWLOCK rwlock) { // expects: mutex is locked static inline void rwlock_write_lock(RWLOCK rwlock, toku_mutex_t *mutex) { +#ifdef TOKU_MYSQL_WITH_PFS + /* Instrumentation start */ + toku_rwlock_instrumentation rwlock_instr; + toku_instr_rwlock_wrlock_wait_start( + rwlock_instr, rwlock->prwlock, __FILE__, __LINE__); +#endif paranoid_invariant(!rwlock->wait_users_go_to_zero); if (rwlock->reader || rwlock->writer) { rwlock->want_write++; @@ -233,12 +276,19 @@ static inline void rwlock_write_lock(RWLOCK rwlock, toku_mutex_t *mutex) { rwlock->want_write--; } rwlock->writer++; +#if defined(TOKU_MYSQL_WITH_PFS) + /* Instrumentation end */ + toku_instr_rwlock_wrlock_wait_end(rwlock_instr, 0); +#endif } // release a write lock // expects: mutex is locked static inline void rwlock_write_unlock(RWLOCK rwlock) { +#if defined(TOKU_MYSQL_WITH_PFS) + toku_instr_rwlock_unlock(rwlock->prwlock); +#endif paranoid_invariant(rwlock->reader == 0); paranoid_invariant(rwlock->writer == 1); rwlock->writer--; @@ -284,14 +334,10 @@ static inline int rwlock_read_will_block(RWLOCK rwlock) { return (rwlock->writer > 0 || rwlock->want_write > 0); } -static inline void rwlock_wait_for_users( - RWLOCK rwlock, - toku_mutex_t *mutex - ) -{ +static inline void rwlock_wait_for_users(RWLOCK rwlock, toku_mutex_t *mutex) { paranoid_invariant(!rwlock->wait_users_go_to_zero); toku_cond_t cond; - toku_cond_init(&cond, NULL); + toku_cond_init(toku_uninstrumented, &cond, nullptr); while (rwlock_users(rwlock) > 0) { rwlock->wait_users_go_to_zero = &cond; toku_cond_wait(&cond, mutex); diff --git a/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc b/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc index bce1b1a885b526ef45bb4941f47890fa256826f2..7e60c711c668d63ba43e974b5668327f6150dce5 100644 --- a/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc +++ b/storage/tokudb/PerconaFT/util/tests/marked-omt-test.cc @@ -156,7 +156,7 @@ int int_heaviside(const uint32_t &v, const uint32_t &target) { struct stress_shared { stress_omt *omt; volatile bool running; - struct rwlock lock; + struct st_rwlock lock; toku_mutex_t mutex; int num_marker_threads; }; @@ -400,8 +400,8 @@ static void stress_test(int nelts) { struct stress_shared extra; ZERO_STRUCT(extra); extra.omt = &omt; - toku_mutex_init(&extra.mutex, NULL); - rwlock_init(&extra.lock); + toku_mutex_init(toku_uninstrumented, &extra.mutex, nullptr); + rwlock_init(toku_uninstrumented, &extra.lock); extra.running = true; extra.num_marker_threads = num_marker_threads; @@ -422,11 +422,19 @@ static void stress_test(int nelts) { r = myinitstate_r(seed, reader.buf_write, 8, &reader.rand_write); invariant_zero(r); - toku_pthread_create(&marker_threads[i], NULL, stress_mark_worker, &reader); + toku_pthread_create(toku_uninstrumented, + &marker_threads[i], + nullptr, + stress_mark_worker, + &reader); } toku_pthread_t deleter_thread; - toku_pthread_create(&deleter_thread, NULL, stress_delete_worker, &readers[0]); + toku_pthread_create(toku_uninstrumented, + &deleter_thread, + nullptr, + stress_delete_worker, + &readers[0]); toku_pthread_join(deleter_thread, NULL); for (int i = 0; i < num_marker_threads; ++i) { diff --git a/storage/tokudb/PerconaFT/util/tests/minicron-test.cc b/storage/tokudb/PerconaFT/util/tests/minicron-test.cc index a2ddbdeabdf07edadc27f78985f219488d3daa60..026ab7446d3bdead21afcec236f426d51be4a7cb 100644 --- a/storage/tokudb/PerconaFT/util/tests/minicron-test.cc +++ b/storage/tokudb/PerconaFT/util/tests/minicron-test.cc @@ -206,11 +206,12 @@ test_main (int argc, const char *argv[]) { toku_pthread_t tests[N]; unsigned int i; - for (i=0; istate=0; + rwlock->state = 0; rwlock->waiters_head = NULL; rwlock->waiters_tail = NULL; - toku_mutex_init(&rwlock->mutex, NULL); + toku_mutex_init(toku_uninstrumented, &rwlock->mutex, nullptr); } -void toku_cv_fair_rwlock_destroy (toku_cv_fair_rwlock_t *rwlock) { +void toku_cv_fair_rwlock_destroy(toku_cv_fair_rwlock_t *rwlock) { toku_mutex_destroy(&rwlock->mutex); } diff --git a/storage/tokudb/PerconaFT/util/tests/sm-basic.cc b/storage/tokudb/PerconaFT/util/tests/sm-basic.cc index 80bc965fd316e471cd5f324e6e9a52cf7b208e23..0e5eb8364e2e4f56cd62aeb1ab5ff04ca678051b 100644 --- a/storage/tokudb/PerconaFT/util/tests/sm-basic.cc +++ b/storage/tokudb/PerconaFT/util/tests/sm-basic.cc @@ -64,7 +64,8 @@ int main(void) { // run the test toku_pthread_t tid; int r; - r = toku_pthread_create(&tid, NULL, sm_test_f, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, sm_test_f, nullptr); assert_zero(r); void *ret; r = toku_pthread_join(tid, &ret); diff --git a/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc b/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc index c5d7e3e53a78a13b631cd8aa2f406a888f36cdd3..5aa3565510b79e3ec4b468aaee3a913a4744521d 100644 --- a/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc +++ b/storage/tokudb/PerconaFT/util/tests/sm-crash-double-free.cc @@ -64,10 +64,12 @@ int main(void) { toku_scoped_malloc_init(); toku_pthread_t tid; int r; - r = toku_pthread_create(&tid, NULL, sm_test_f, NULL); + r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, sm_test_f, nullptr); assert_zero(r); void *ret; - while (state != 1) sleep(1); + while (state != 1) + sleep(1); toku_scoped_malloc_destroy_set(); state = 2; r = toku_pthread_join(tid, &ret); diff --git a/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc b/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc index 7fd4801fe1195e78a815c2afabe2c0e0e5091176..9a625c32aeb3534a1376906cc27419e6ebc63dc1 100644 --- a/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc +++ b/storage/tokudb/PerconaFT/util/tests/test-frwlock-fair-writers.cc @@ -66,9 +66,9 @@ static void *t1_func(void *arg) { int main(void) { int r; - toku_mutex_init(&rwlock_mutex, NULL); + toku_mutex_init(toku_uninstrumented, &rwlock_mutex, nullptr); rwlock.init(&rwlock_mutex); - + const int nthreads = 2; pthread_t tids[nthreads]; for (int i = 0; i < nthreads; i++) { diff --git a/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc b/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc index 0075ddf9bcbabafd0b596964fdd0feaefb32ef66..c0b43c2db1ce01da4cc2739d5ffc74ffcc2abca7 100644 --- a/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc +++ b/storage/tokudb/PerconaFT/util/tests/test-rwlock-cheapness.cc @@ -101,7 +101,8 @@ static void *do_read_wait(void *arg) { static void launch_cheap_waiter(void) { toku_pthread_t tid; - int r = toku_pthread_create(&tid, NULL, do_cheap_wait, NULL); + int r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, do_cheap_wait, nullptr); assert_zero(r); toku_pthread_detach(tid); sleep(1); @@ -109,7 +110,8 @@ static void launch_cheap_waiter(void) { static void launch_expensive_waiter(void) { toku_pthread_t tid; - int r = toku_pthread_create(&tid, NULL, do_expensive_wait, NULL); + int r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, do_expensive_wait, nullptr); assert_zero(r); toku_pthread_detach(tid); sleep(1); @@ -117,7 +119,8 @@ static void launch_expensive_waiter(void) { static void launch_reader(void) { toku_pthread_t tid; - int r = toku_pthread_create(&tid, NULL, do_read_wait, NULL); + int r = toku_pthread_create( + toku_uninstrumented, &tid, nullptr, do_read_wait, nullptr); assert_zero(r); toku_pthread_detach(tid); sleep(1); @@ -132,7 +135,7 @@ static bool locks_are_expensive(void) { } static void test_write_cheapness(void) { - toku_mutex_init(&mutex, NULL); + toku_mutex_init(toku_uninstrumented, &mutex, nullptr); w.init(&mutex); // single expensive write lock diff --git a/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc b/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc index 18ca1229f56ce1ebfafb2b3a16f852220b7622e2..56dd3f6b480ba58b614c523f77d41eb2f9a5462a 100644 --- a/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc +++ b/storage/tokudb/PerconaFT/util/tests/test-rwlock.cc @@ -245,14 +245,14 @@ static void util_rwlock_unlock (RWLOCK rwlock, toku_mutex_t *mutex) { } // Time the read lock that's in util/rwlock.h -void time_util_rwlock (void) __attribute((__noinline__)); -void time_util_rwlock (void) { - struct rwlock rwlock; +void time_util_rwlock(void) __attribute((__noinline__)); +void time_util_rwlock(void) { + struct st_rwlock rwlock; toku_mutex_t external_mutex; - toku_mutex_init(&external_mutex, NULL); - rwlock_init(&rwlock); - struct timeval start,end; - + toku_mutex_init(toku_uninstrumented, &external_mutex, nullptr); + rwlock_init(toku_uninstrumented, &rwlock); + struct timeval start, end; + util_rwlock_lock(&rwlock, &external_mutex); util_rwlock_unlock(&rwlock, &external_mutex); for (int t=0; tthreadpool, max_threads); assert(r == 0); + r = toku_thread_pool_create(&my_threadpool->threadpool, max_threads); + assert(r == 0); assert(my_threadpool != 0); - toku_mutex_init(&my_threadpool->mutex, 0); - toku_cond_init(&my_threadpool->wait, 0); + toku_mutex_init(toku_uninstrumented, &my_threadpool->mutex, nullptr); + toku_cond_init(toku_uninstrumented, &my_threadpool->wait, nullptr); my_threadpool->closed = 0; my_threadpool->counter = 0; } diff --git a/storage/tokudb/PerconaFT/util/threadpool.cc b/storage/tokudb/PerconaFT/util/threadpool.cc index 146cc63242a2aba03eb8c4c9a2118e8b64c189e9..6e0ccf05f93851cd2a96a5b4dc09954a7098ba32 100644 --- a/storage/tokudb/PerconaFT/util/threadpool.cc +++ b/storage/tokudb/PerconaFT/util/threadpool.cc @@ -48,6 +48,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "threadpool.h" +toku_instr_key *tpool_lock_mutex_key; +toku_instr_key *tp_thread_wait_key; +toku_instr_key *tp_pool_wait_free_key; +toku_instr_key *tp_internal_thread_key; + struct toku_thread { struct toku_thread_pool *pool; toku_pthread_t tid; @@ -84,8 +89,12 @@ toku_thread_create(struct toku_thread_pool *pool, struct toku_thread **toku_thre } else { memset(thread, 0, sizeof *thread); thread->pool = pool; - toku_cond_init(&thread->wait, nullptr); - r = toku_pthread_create(&thread->tid, nullptr, toku_thread_run_internal, thread); + toku_cond_init(*tp_thread_wait_key, &thread->wait, nullptr); + r = toku_pthread_create(*tp_internal_thread_key, + &thread->tid, + nullptr, + toku_thread_run_internal, + thread); if (r) { toku_cond_destroy(&thread->wait); toku_free(thread); @@ -105,11 +114,11 @@ toku_thread_run(struct toku_thread *thread, void *(*f)(void *arg), void *arg) { toku_thread_pool_unlock(thread->pool); } -static void -toku_thread_destroy(struct toku_thread *thread) { +static void toku_thread_destroy(struct toku_thread *thread) { int r; void *ret; - r = toku_pthread_join(thread->tid, &ret); invariant(r == 0 && ret == thread); + r = toku_pthread_join(thread->tid, &ret); + invariant(r == 0 && ret == thread); struct toku_thread_pool *pool = thread->pool; toku_thread_pool_lock(pool); toku_list_remove(&thread->free_link); @@ -147,20 +156,20 @@ toku_thread_run_internal(void *arg) { thread->f = nullptr; toku_list_push(&pool->free_threads, &thread->free_link); } - return arg; -} + return toku_pthread_done(arg); +} -int -toku_thread_pool_create(struct toku_thread_pool **pool_return, int max_threads) { +int toku_thread_pool_create(struct toku_thread_pool **pool_return, + int max_threads) { int r; struct toku_thread_pool *CALLOC(pool); if (pool == nullptr) { r = get_error_errno(); } else { - toku_mutex_init(&pool->lock, nullptr); + toku_mutex_init(*tpool_lock_mutex_key, &pool->lock, nullptr); toku_list_init(&pool->free_threads); toku_list_init(&pool->all_threads); - toku_cond_init(&pool->wait_free, nullptr); + toku_cond_init(*tp_pool_wait_free_key, &pool->wait_free, nullptr); pool->cur_threads = 0; pool->max_threads = max_threads; *pool_return = pool; diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index 56bebf1c3ec2644a29a4525182264f4eae59d4e9..cdd4adb0947642ebd7a0695488b2c088a1f5fe7d 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -31,6 +31,8 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include "ha_tokudb.h" #include "sql_db.h" +pfs_key_t ha_tokudb_mutex_key; +pfs_key_t num_DBs_lock_key; #if TOKU_INCLUDE_EXTENDED_KEYS static inline uint get_ext_key_parts(const KEY *key) { @@ -187,13 +189,9 @@ const char* TOKUDB_SHARE::get_state_string(share_state_t state) { void* TOKUDB_SHARE::operator new(size_t sz) { return tokudb::memory::malloc(sz, MYF(MY_WME|MY_ZEROFILL|MY_FAE)); } -void TOKUDB_SHARE::operator delete(void* p) { - tokudb::memory::free(p); -} -TOKUDB_SHARE::TOKUDB_SHARE() : - _num_DBs_lock(), - _mutex() { -} +void TOKUDB_SHARE::operator delete(void* p) { tokudb::memory::free(p); } +TOKUDB_SHARE::TOKUDB_SHARE() + : _num_DBs_lock(num_DBs_lock_key), _mutex(ha_tokudb_mutex_key) {} void TOKUDB_SHARE::init(const char* table_name) { _use_count = 0; thr_lock_init(&_thr_lock); @@ -228,20 +226,15 @@ void TOKUDB_SHARE::destroy() { thr_lock_delete(&_thr_lock); TOKUDB_SHARE_DBUG_VOID_RETURN(); } -TOKUDB_SHARE* TOKUDB_SHARE::get_share( - const char* table_name, - TABLE_SHARE* table_share, - THR_LOCK_DATA* data, - bool create_new) { - - _open_tables_mutex.lock(); +TOKUDB_SHARE* TOKUDB_SHARE::get_share(const char* table_name, + TABLE_SHARE* table_share, + THR_LOCK_DATA* data, + bool create_new) { + mutex_t_lock(_open_tables_mutex); int error = 0; - uint length = (uint) strlen(table_name); - TOKUDB_SHARE* share = - (TOKUDB_SHARE*)my_hash_search( - &_open_tables, - (uchar*)table_name, - length); + uint length = (uint)strlen(table_name); + TOKUDB_SHARE* share = (TOKUDB_SHARE*)my_hash_search( + &_open_tables, (uchar*)table_name, length); TOKUDB_TRACE_FOR_FLAGS( TOKUDB_DEBUG_SHARE, @@ -276,28 +269,27 @@ TOKUDB_SHARE* TOKUDB_SHARE::get_share( thr_lock_data_init(&(share->_thr_lock), data, NULL); exit: - _open_tables_mutex.unlock(); + mutex_t_unlock(_open_tables_mutex); return share; } void TOKUDB_SHARE::drop_share(TOKUDB_SHARE* share) { - TOKUDB_TRACE_FOR_FLAGS( - TOKUDB_DEBUG_SHARE, - "share[%p]:file[%s]:state[%s]:use_count[%d]", - share, - share->_full_table_name.ptr(), - get_state_string(share->_state), - share->_use_count); - - _open_tables_mutex.lock(); + TOKUDB_TRACE_FOR_FLAGS(TOKUDB_DEBUG_SHARE, + "share[%p]:file[%s]:state[%s]:use_count[%d]", + share, + share->_full_table_name.ptr(), + get_state_string(share->_state), + share->_use_count); + + mutex_t_lock(_open_tables_mutex); my_hash_delete(&_open_tables, (uchar*)share); - _open_tables_mutex.unlock(); + mutex_t_unlock(_open_tables_mutex); } TOKUDB_SHARE::share_state_t TOKUDB_SHARE::addref() { TOKUDB_SHARE_TRACE_FOR_FLAGS((TOKUDB_DEBUG_ENTER & TOKUDB_DEBUG_SHARE), - "file[%s]:state[%s]:use_count[%d]", - _full_table_name.ptr(), - get_state_string(_state), - _use_count); + "file[%s]:state[%s]:use_count[%d]", + _full_table_name.ptr(), + get_state_string(_state), + _use_count); lock(); _use_count++; @@ -312,7 +304,7 @@ int TOKUDB_SHARE::release() { int error, result = 0; - _mutex.lock(); + mutex_t_lock(_mutex); assert_always(_use_count != 0); _use_count--; if (_use_count == 0 && _state == TOKUDB_SHARE::OPENED) { @@ -356,7 +348,7 @@ int TOKUDB_SHARE::release() { _state = TOKUDB_SHARE::CLOSED; } - _mutex.unlock(); + mutex_t_unlock(_mutex); TOKUDB_SHARE_DBUG_RETURN(result); } @@ -1195,8 +1187,10 @@ static int generate_row_for_put( ha_tokudb::ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg):handler(hton, table_arg) { TOKUDB_HANDLER_DBUG_ENTER(""); share = NULL; - int_table_flags = HA_REC_NOT_IN_SEQ | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | - HA_FILE_BASED | HA_AUTO_PART_KEY | HA_TABLE_SCAN_ON_INDEX | HA_CAN_WRITE_DURING_OPTIMIZE; + int_table_flags = HA_REC_NOT_IN_SEQ | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS + | HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION + | HA_FILE_BASED | HA_AUTO_PART_KEY | HA_TABLE_SCAN_ON_INDEX + | HA_CAN_WRITE_DURING_OPTIMIZE | HA_ONLINE_ANALYZE; alloc_ptr = NULL; rec_buff = NULL; rec_update_buff = NULL; @@ -3313,12 +3307,12 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) { delay_updating_ai_metadata = true; ai_metadata_update_required = false; abort_loader = false; - - share->_num_DBs_lock.lock_read(); + + rwlock_t_lock_read(share->_num_DBs_lock); uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key); num_DBs_locked_in_bulk = true; lock_count = 0; - + if ((rows == 0 || rows > 1) && share->try_table_lock) { if (tokudb::sysvars::prelock_empty(thd) && may_table_be_empty(transaction) && @@ -4030,14 +4024,13 @@ int ha_tokudb::write_row(uchar * record) { // grab reader lock on numDBs_lock // if (!num_DBs_locked_in_bulk) { - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); num_DBs_locked = true; - } - else { + } else { lock_count++; if (lock_count >= 2000) { share->_num_DBs_lock.unlock(); - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); lock_count = 0; } } @@ -4208,7 +4201,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { // bool num_DBs_locked = false; if (!num_DBs_locked_in_bulk) { - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); num_DBs_locked = true; } curr_num_DBs = share->num_DBs; @@ -4350,7 +4343,7 @@ int ha_tokudb::delete_row(const uchar * record) { // bool num_DBs_locked = false; if (!num_DBs_locked_in_bulk) { - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); num_DBs_locked = true; } curr_num_DBs = share->num_DBs; @@ -4641,6 +4634,9 @@ int ha_tokudb::index_init(uint keynr, bool sorted) { if (tokudb::sysvars::disable_prefetching(thd)) { cursor_flags |= DBC_DISABLE_PREFETCHING; } + if (lock.type == TL_READ_WITH_SHARED_LOCKS) { + cursor_flags |= DB_LOCKING_READ; + } if ((error = share->key_file[keynr]->cursor(share->key_file[keynr], transaction, &cursor, cursor_flags))) { @@ -6212,6 +6208,8 @@ int ha_tokudb::info(uint flag) { } if ((flag & HA_STATUS_CONST)) { stats.max_data_file_length = 9223372036854775807ULL; + } + if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST)) { share->set_cardinality_counts_in_table(table); } @@ -6295,7 +6293,7 @@ int ha_tokudb::acquire_table_lock (DB_TXN* trans, TABLE_LOCK_TYPE lt) { TOKUDB_HANDLER_DBUG_ENTER("%p %s", trans, lt == lock_read ? "r" : "w"); int error = ENOSYS; if (!num_DBs_locked_in_bulk) { - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); } uint curr_num_DBs = share->num_DBs; if (lt == lock_read) { @@ -6651,8 +6649,9 @@ THR_LOCK_DATA* *ha_tokudb::store_lock( if (sql_command == SQLCOM_CREATE_INDEX && tokudb::sysvars::create_index_online(thd)) { // hot indexing - share->_num_DBs_lock.lock_read(); - if (share->num_DBs == (table->s->keys + tokudb_test(hidden_primary_key))) { + rwlock_t_lock_read(share->_num_DBs_lock); + if (share->num_DBs == + (table->s->keys + tokudb_test(hidden_primary_key))) { lock_type = TL_WRITE_ALLOW_WRITE; } share->_num_DBs_lock.unlock(); @@ -7225,10 +7224,28 @@ int ha_tokudb::create( const tokudb::sysvars::row_format_t row_format = (tokudb::sysvars::row_format_t)form->s->option_struct->row_format; #else - const tokudb::sysvars::row_format_t row_format = - (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) - ? row_type_to_row_format(create_info->row_type) - : tokudb::sysvars::row_format(thd); + // TDB-76 : CREATE TABLE ... LIKE ... does not use source row_format on + // target table + // Original code would only use create_info->row_type if + // create_info->used_fields & HA_CREATE_USED_ROW_FORMAT was true. This + // would cause us to skip transferring the row_format for a table created + // via CREATE TABLE tn LIKE tn. We also take on more InnoDB like behavior + // and throw a warning if we get a row_format that we can't translate into + // a known TokuDB row_format. + tokudb::sysvars::row_format_t row_format = + tokudb::sysvars::row_format(thd); + + if ((create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) || + create_info->row_type != ROW_TYPE_DEFAULT) { + row_format = row_type_to_row_format(create_info->row_type); + if (row_format == tokudb::sysvars::SRV_ROW_FORMAT_DEFAULT && + create_info->row_type != ROW_TYPE_DEFAULT) { + push_warning(thd, + Sql_condition::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "TokuDB: invalid ROW_FORMAT specifier."); + } + } #endif const toku_compression_method compression_method = row_format_to_toku_compression_method(row_format); @@ -8112,8 +8129,8 @@ int ha_tokudb::tokudb_add_index( } } } - - share->_num_DBs_lock.lock_write(); + + rwlock_t_lock_write(share->_num_DBs_lock); rw_lock_taken = true; // // open all the DB files and set the appropriate variables in share @@ -8223,7 +8240,7 @@ int ha_tokudb::tokudb_add_index( goto cleanup; } - share->_num_DBs_lock.lock_write(); + rwlock_t_lock_write(share->_num_DBs_lock); error = indexer->close(indexer); share->_num_DBs_lock.unlock(); if (error) { @@ -8457,7 +8474,7 @@ int ha_tokudb::tokudb_add_index( if (indexer != NULL) { sprintf(status_msg, "aborting creation of indexes."); thd_proc_info(thd, status_msg); - share->_num_DBs_lock.lock_write(); + rwlock_t_lock_write(share->_num_DBs_lock); indexer->abort(indexer); share->_num_DBs_lock.unlock(); } @@ -8506,10 +8523,10 @@ void ha_tokudb::restore_add_index( // // need to restore num_DBs, and we have to do it before we close the dictionaries - // so that there is not a window + // so that there is not a window // if (incremented_numDBs) { - share->_num_DBs_lock.lock_write(); + rwlock_t_lock_write(share->_num_DBs_lock); share->num_DBs--; } if (modified_DBs) { diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 3891e57738b36f20b87a17658712d7334a42cb1c..a2fd747bb92536229502d1ca8f31695f14ecf803 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -318,18 +318,18 @@ inline int TOKUDB_SHARE::use_count() const { } inline void TOKUDB_SHARE::lock() const { TOKUDB_SHARE_DBUG_ENTER("file[%s]:state[%s]:use_count[%d]", - _full_table_name.ptr(), - get_state_string(_state), - _use_count); - _mutex.lock(); + _full_table_name.ptr(), + get_state_string(_state), + _use_count); + mutex_t_lock(_mutex); TOKUDB_SHARE_DBUG_VOID_RETURN(); } inline void TOKUDB_SHARE::unlock() const { TOKUDB_SHARE_DBUG_ENTER("file[%s]:state[%s]:use_count[%d]", - _full_table_name.ptr(), - get_state_string(_state), - _use_count); - _mutex.unlock(); + _full_table_name.ptr(), + get_state_string(_state), + _use_count); + mutex_t_unlock(_mutex); TOKUDB_SHARE_DBUG_VOID_RETURN(); } inline TOKUDB_SHARE::share_state_t TOKUDB_SHARE::state() const { diff --git a/storage/tokudb/ha_tokudb_update.cc b/storage/tokudb/ha_tokudb_update.cc index 23de81f3d8af11eb855950ed82433efeacc2d07a..9fe5e729ec4e87ee4b31351c28ad6cbb0a8c983c 100644 --- a/storage/tokudb/ha_tokudb_update.cc +++ b/storage/tokudb/ha_tokudb_update.cc @@ -918,7 +918,7 @@ int ha_tokudb::send_update_message( marshall_update(update_message, lhs_item, rhs_item, table, share); } - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); // hot index in progress if (share->num_DBs > table->s->keys + tokudb_test(hidden_primary_key)) { @@ -1108,7 +1108,7 @@ int ha_tokudb::send_upsert_message( marshall_update(update_message, lhs_item, rhs_item, table, share); } - share->_num_DBs_lock.lock_read(); + rwlock_t_lock_read(share->_num_DBs_lock); // hot index in progress if (share->num_DBs > table->s->keys + tokudb_test(hidden_primary_key)) { diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc index 13bc60e9d98765881706c03c0e8dd77c9280ee6a..88ba83ea0ab1651d4bbdf708271d46b49ba139dc 100644 --- a/storage/tokudb/hatoku_cmp.cc +++ b/storage/tokudb/hatoku_cmp.cc @@ -1984,6 +1984,7 @@ static uint32_t pack_desc_key_length_info(uchar* buf, KEY_AND_COL_INFO* kc_info, case (toku_type_fixstring): field_length = field->pack_length(); set_if_smaller(key_part_length, field_length); + // fallthrough case (toku_type_varbinary): case (toku_type_varstring): case (toku_type_blob): diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h index 1b33e0a53e44222e911b955735ee5f2818d02535..360272969e57d9d9b2a0b10e85e48d66476181de 100644 --- a/storage/tokudb/hatoku_defines.h +++ b/storage/tokudb/hatoku_defines.h @@ -168,6 +168,14 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #define HA_CAN_WRITE_DURING_OPTIMIZE 0 #endif +#if !defined(HA_ONLINE_ANALYZE) +#define HA_ONLINE_ANALYZE 0 +#endif + +#if !defined(MY_ATTRIBUTE) +#define MY_ATTRIBUTE(A) __attribute__(A) +#endif + #if !defined(HA_OPTION_CREATE_FROM_ENGINE) #define HA_OPTION_CREATE_FROM_ENGINE 0 #endif @@ -248,4 +256,22 @@ inline uint tokudb_uint3korr(const uchar *a) { return uint3korr(b); } -#endif // _HATOKU_DEFINES_H +typedef unsigned int pfs_key_t; + +#if defined(HAVE_PSI_MUTEX_INTERFACE) +#define mutex_t_lock(M) M.lock(__FILE__, __LINE__) +#define mutex_t_unlock(M) M.unlock(__FILE__, __LINE__) +#else // HAVE_PSI_MUTEX_INTERFACE +#define mutex_t_lock(M) M.lock() +#define mutex_t_unlock(M) M.unlock() +#endif // HAVE_PSI_MUTEX_INTERFACE + +#if defined(HAVE_PSI_RWLOCK_INTERFACE) +#define rwlock_t_lock_read(M) M.lock_read(__FILE__, __LINE__) +#define rwlock_t_lock_write(M) M.lock_write(__FILE__, __LINE__) +#else // HAVE_PSI_RWLOCK_INTERFACE +#define rwlock_t_lock_read(M) M.lock_read() +#define rwlock_t_lock_write(M) M.lock_write() +#endif // HAVE_PSI_RWLOCK_INTERFACE + +#endif // _HATOKU_DEFINES_H diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index 7b44044bd816eef8b1de79148c1b7e287fc3e772..ac0976fb1193ef4ed90cb943bae73b32de7ea54e 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -28,6 +28,17 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #define TOKU_METADB_NAME "tokudb_meta" +static pfs_key_t tokudb_map_mutex_key; + +static PSI_mutex_info all_tokudb_mutexes[] = { + {&tokudb_map_mutex_key, "tokudb_map_mutex", 0}, + {&ha_tokudb_mutex_key, "ha_tokudb_mutex", 0}, +}; + +static PSI_rwlock_info all_tokudb_rwlocks[] = { + {&num_DBs_lock_key, "num_DBs_lock", 0}, +}; + typedef struct savepoint_info { DB_TXN* txn; tokudb_trx_data* trx; @@ -109,8 +120,8 @@ handlerton* tokudb_hton; const char* ha_tokudb_ext = ".tokudb"; DB_ENV* db_env; -#if TOKU_THDVAR_MEMALLOC_BUG static tokudb::thread::mutex_t tokudb_map_mutex; +#if TOKU_THDVAR_MEMALLOC_BUG static TREE tokudb_map; struct tokudb_map_pair { THD* thd; @@ -212,6 +223,10 @@ extern "C" { // use constructor and destructor functions to create and destroy // the lock before and after main(), respectively. int tokudb_hton_initialized; + +// tokudb_hton_initialized_lock can not be instrumented as it must be +// initialized before mysql_mutex_register() call to protect +// some globals from race condition. tokudb::thread::rwlock_t tokudb_hton_initialized_lock; static SHOW_VAR *toku_global_status_variables = NULL; @@ -267,10 +282,23 @@ static int tokudb_init_func(void *p) { int r; // 3938: lock the handlerton's initialized status flag for writing - tokudb_hton_initialized_lock.lock_write(); + rwlock_t_lock_write(tokudb_hton_initialized_lock); + +#ifdef HAVE_PSI_INTERFACE + /* Register TokuDB mutex keys with MySQL performance schema */ + int count; + + count = array_elements(all_tokudb_mutexes); + mysql_mutex_register("tokudb", all_tokudb_mutexes, count); + + count = array_elements(all_tokudb_rwlocks); + mysql_rwlock_register("tokudb", all_tokudb_rwlocks, count); + + tokudb_map_mutex.reinit(tokudb_map_mutex_key); +#endif /* HAVE_PSI_INTERFACE */ db_env = NULL; - tokudb_hton = (handlerton *) p; + tokudb_hton = (handlerton*)p; if (tokudb::sysvars::check_jemalloc) { typedef int (*mallctl_type)( @@ -668,7 +696,7 @@ int tokudb_end(handlerton* hton, ha_panic_function type) { // initialized. grab a writer lock for the duration of the // call, so we can drop the flag and destroy the mutexes // in isolation. - tokudb_hton_initialized_lock.lock_write(); + rwlock_t_lock_write(tokudb_hton_initialized_lock); assert_always(tokudb_hton_initialized); tokudb::background::destroy(); @@ -748,16 +776,16 @@ static int tokudb_close_connection(handlerton* hton, THD* thd) { } tokudb::memory::free(trx); #if TOKU_THDVAR_MEMALLOC_BUG - tokudb_map_mutex.lock(); - struct tokudb_map_pair key = { thd, NULL }; + mutex_t_lock(tokudb_map_mutex); + struct tokudb_map_pair key = {thd, NULL}; struct tokudb_map_pair* found_key = - (struct tokudb_map_pair*) tree_search(&tokudb_map, &key, NULL); + (struct tokudb_map_pair*)tree_search(&tokudb_map, &key, NULL); if (found_key) { tokudb::memory::free(found_key->last_lock_timeout); tree_delete(&tokudb_map, found_key, sizeof(*found_key), NULL); } - tokudb_map_mutex.unlock(); + mutex_t_unlock(tokudb_map_mutex); #endif return error; } @@ -1718,12 +1746,12 @@ static void tokudb_lock_timeout_callback( tokudb::memory::strdup(log_str.c_ptr(), MY_FAE); tokudb::sysvars::set_last_lock_timeout(thd, new_lock_timeout); #if TOKU_THDVAR_MEMALLOC_BUG - tokudb_map_mutex.lock(); - struct tokudb_map_pair old_key = { thd, old_lock_timeout }; + mutex_t_lock(tokudb_map_mutex); + struct tokudb_map_pair old_key = {thd, old_lock_timeout}; tree_delete(&tokudb_map, &old_key, sizeof old_key, NULL); - struct tokudb_map_pair new_key = { thd, new_lock_timeout }; + struct tokudb_map_pair new_key = {thd, new_lock_timeout}; tree_insert(&tokudb_map, &new_key, sizeof new_key, NULL); - tokudb_map_mutex.unlock(); + mutex_t_unlock(tokudb_map_mutex); #endif tokudb::memory::free(old_lock_timeout); } diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h index d126ff4339f26134078aeda85d2fdc4cca3a68e4..80e13fa9b0c57c64f220e13af4d4d9ae8dc6cda4 100644 --- a/storage/tokudb/hatoku_hton.h +++ b/storage/tokudb/hatoku_hton.h @@ -39,6 +39,9 @@ extern handlerton* tokudb_hton; extern DB_ENV* db_env; +extern pfs_key_t ha_tokudb_mutex_key; +extern pfs_key_t num_DBs_lock_key; + inline tokudb::sysvars::row_format_t toku_compression_method_to_row_format( toku_compression_method method) { @@ -180,9 +183,7 @@ inline bool tokudb_killed_thd_callback(void *extra, uint64_t deleted_rows) { return thd_kill_level(thd) != 0; } - extern HASH tokudb_open_tables; -extern tokudb::thread::mutex_t tokudb_mutex; extern const char* tokudb_hton_name; extern int tokudb_hton_initialized; extern tokudb::thread::rwlock_t tokudb_hton_initialized_lock; diff --git a/storage/tokudb/mysql-test/tokudb/disabled.def b/storage/tokudb/mysql-test/tokudb/disabled.def index ddefceb432ed7178acc65056ac6627e54f985a72..7f354cd8ba67fd2f6c7b24a80cfb418c8e3eb307 100644 --- a/storage/tokudb/mysql-test/tokudb/disabled.def +++ b/storage/tokudb/mysql-test/tokudb/disabled.def @@ -29,3 +29,4 @@ cluster_key_part: engine options on partitioned tables i_s_tokudb_lock_waits_released: unstable, race conditions i_s_tokudb_locks_released: unstable, race conditions row_format: n/a +nonflushing_analyze_debug: Freezes in MariaDB 10.0 diff --git a/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result b/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result index cfd7e38179cbe795381a83bd3eb376addaef0a5f..981433fac9137e77e5e404c664e1d8aefb630fd1 100644 --- a/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result +++ b/storage/tokudb/mysql-test/tokudb/r/card_scale_percent.result @@ -1,7 +1,7 @@ -set global tokudb_cardinality_scale_percent = 10; analyze table tt; Table Op Msg_type Msg_text test.tt analyze status OK +set global tokudb_cardinality_scale_percent = 10; show indexes from tt; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment tt 0 PRIMARY 1 a A 4000 NULL NULL BTREE @@ -9,9 +9,6 @@ tt 1 b 1 b A 4000 NULL NULL YES BTREE tt 1 c 1 c A 4000 NULL NULL YES BTREE tt 1 d 1 d A 4000 NULL NULL YES BTREE set global tokudb_cardinality_scale_percent = 50; -analyze table tt; -Table Op Msg_type Msg_text -test.tt analyze status OK show indexes from tt; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment tt 0 PRIMARY 1 a A 4000 NULL NULL BTREE @@ -19,9 +16,6 @@ tt 1 b 1 b A 4000 NULL NULL YES BTREE tt 1 c 1 c A 4000 NULL NULL YES BTREE tt 1 d 1 d A 2000 NULL NULL YES BTREE set global tokudb_cardinality_scale_percent = 100; -analyze table tt; -Table Op Msg_type Msg_text -test.tt analyze status OK show indexes from tt; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment tt 0 PRIMARY 1 a A 4000 NULL NULL BTREE @@ -31,9 +25,6 @@ tt 1 d 1 d A 1000 NULL NULL YES BTREE set global tokudb_cardinality_scale_percent = 200; Warnings: Warning 1292 Truncated incorrect tokudb_cardinality_scale_percent value: '200' -analyze table tt; -Table Op Msg_type Msg_text -test.tt analyze status OK show indexes from tt; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment tt 0 PRIMARY 1 a A 4000 NULL NULL BTREE diff --git a/storage/tokudb/mysql-test/tokudb/r/locking-read-repeatable-read-1.result b/storage/tokudb/mysql-test/tokudb/r/locking-read-repeatable-read-1.result new file mode 100644 index 0000000000000000000000000000000000000000..c9fcb5e227363c05ce658be43c16d66f804bcad8 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/r/locking-read-repeatable-read-1.result @@ -0,0 +1,13 @@ +create table t (a int primary key, b int) ENGINE=TokuDB; +insert into t values (1,0); +set session transaction isolation level repeatable read; +begin; +select * from t where a=1 lock in share mode; +a b +1 0 +set session transaction isolation level repeatable read; +begin; +update t set b=b+1 where a=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/r/locking-read-repeatable-read-2.result b/storage/tokudb/mysql-test/tokudb/r/locking-read-repeatable-read-2.result new file mode 100644 index 0000000000000000000000000000000000000000..f1b214e514c43f834bc6bea9dc17ac75266e87ec --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/r/locking-read-repeatable-read-2.result @@ -0,0 +1,17 @@ +create table t (a int primary key, b int) ENGINE=TokuDB; +insert into t values (1,0); +insert into t values (2,1); +insert into t values (3,2); +set session transaction isolation level repeatable read; +begin; +select * from t lock in share mode; +a b +1 0 +2 1 +3 2 +set session transaction isolation level repeatable read; +begin; +update t set b=b+1 where a=2; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +commit; +drop table t; diff --git a/storage/tokudb/mysql-test/tokudb/r/nonflushing_analyze_debug.result b/storage/tokudb/mysql-test/tokudb/r/nonflushing_analyze_debug.result new file mode 100644 index 0000000000000000000000000000000000000000..e8f51edee04b924a21c6d8abd5944f8af0ea87a0 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/r/nonflushing_analyze_debug.result @@ -0,0 +1,19 @@ +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=TokuDB; +INSERT INTO t1 VALUES (1), (2), (3); +SET DEBUG_SYNC="handler_ha_index_next_end SIGNAL idx_scan_in_progress WAIT_FOR finish_scan"; +SELECT * FROM t1; +SET DEBUG_SYNC="now WAIT_FOR idx_scan_in_progress"; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT * FROM t1; +a +1 +2 +3 +SET DEBUG_SYNC="now SIGNAL finish_scan"; +a +1 +2 +3 +DROP TABLE t1; diff --git a/storage/tokudb/mysql-test/tokudb/r/row_format.result b/storage/tokudb/mysql-test/tokudb/r/row_format.result index cb6691484456221efcdde19bf6378a2bcdacd330..15d4f9fe12ad080a01f7fb8bc7ba2b10434733e4 100644 --- a/storage/tokudb/mysql-test/tokudb/r/row_format.result +++ b/storage/tokudb/mysql-test/tokudb/r/row_format.result @@ -1,4 +1,6 @@ CREATE TABLE tokudb_row_format_test_1 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_DEFAULT; +Warnings: +Warning 1478 TokuDB: invalid ROW_FORMAT specifier. CREATE TABLE tokudb_row_format_test_2 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_FAST; CREATE TABLE tokudb_row_format_test_3 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_SMALL; CREATE TABLE tokudb_row_format_test_4 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_UNCOMPRESSED; @@ -6,6 +8,41 @@ CREATE TABLE tokudb_row_format_test_5 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_ZL CREATE TABLE tokudb_row_format_test_6 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_LZMA; CREATE TABLE tokudb_row_format_test_7 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_QUICKLZ; CREATE TABLE tokudb_row_format_test_8 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_SNAPPY; +CREATE TABLE tdb76_1 LIKE tokudb_row_format_test_1; +CREATE TABLE tdb76_2 LIKE tokudb_row_format_test_2; +CREATE TABLE tdb76_3 LIKE tokudb_row_format_test_3; +CREATE TABLE tdb76_4 LIKE tokudb_row_format_test_4; +CREATE TABLE tdb76_5 LIKE tokudb_row_format_test_5; +CREATE TABLE tdb76_6 LIKE tokudb_row_format_test_6; +CREATE TABLE tdb76_7 LIKE tokudb_row_format_test_7; +CREATE TABLE tdb76_8 LIKE tokudb_row_format_test_8; +CREATE TABLE tdb76_compact(a INT) ENGINE=TokuDB ROW_FORMAT=COMPACT; +Warnings: +Warning 1478 TokuDB: invalid ROW_FORMAT specifier. +CREATE TABLE tdb76_redundant(a INT) ENGINE=TokuDB ROW_FORMAT=REDUNDANT; +Warnings: +Warning 1478 TokuDB: invalid ROW_FORMAT specifier. +CREATE TABLE tdb76_dynamic(a INT) ENGINE=TokuDB ROW_FORMAT=DYNAMIC; +Warnings: +Warning 1478 TokuDB: invalid ROW_FORMAT specifier. +CREATE TABLE tdb76_compressed(a INT) ENGINE=TokuDB ROW_FORMAT=COMPRESSED; +Warnings: +Warning 1478 TokuDB: invalid ROW_FORMAT specifier. +SELECT table_name, row_format, engine FROM information_schema.tables WHERE table_name like 'tdb76_%' ORDER BY table_name; +table_name row_format engine +tdb76_1 tokudb_zlib TokuDB +tdb76_2 tokudb_quicklz TokuDB +tdb76_3 tokudb_lzma TokuDB +tdb76_4 tokudb_uncompressed TokuDB +tdb76_5 tokudb_zlib TokuDB +tdb76_6 tokudb_lzma TokuDB +tdb76_7 tokudb_quicklz TokuDB +tdb76_8 tokudb_snappy TokuDB +tdb76_compact tokudb_zlib TokuDB +tdb76_compressed tokudb_zlib TokuDB +tdb76_dynamic tokudb_zlib TokuDB +tdb76_redundant tokudb_zlib TokuDB +DROP TABLE tdb76_1, tdb76_2, tdb76_3, tdb76_4, tdb76_5, tdb76_6, tdb76_7, tdb76_8, tdb76_compact, tdb76_redundant, tdb76_dynamic, tdb76_compressed; SELECT table_name, row_format, engine FROM information_schema.tables WHERE table_name like 'tokudb_row_format_test%' ORDER BY table_name; table_name row_format engine tokudb_row_format_test_1 tokudb_zlib TokuDB @@ -45,6 +82,8 @@ SELECT table_name, row_format, engine FROM information_schema.tables WHERE table table_name row_format engine tokudb_row_format_test_1 tokudb_lzma TokuDB ALTER TABLE tokudb_row_format_test_1 ENGINE=TokuDB ROW_FORMAT=TOKUDB_DEFAULT; +Warnings: +Warning 1478 TokuDB: invalid ROW_FORMAT specifier. SELECT table_name, row_format, engine FROM information_schema.tables WHERE table_name = 'tokudb_row_format_test_1'; table_name row_format engine tokudb_row_format_test_1 tokudb_zlib TokuDB diff --git a/storage/tokudb/mysql-test/tokudb/t/card_scale_percent.test b/storage/tokudb/mysql-test/tokudb/t/card_scale_percent.test index 47f1eb37989293548c1d3c220476f30085115f8c..75c53611308b21f42b371f9a5b2df712713255b7 100644 --- a/storage/tokudb/mysql-test/tokudb/t/card_scale_percent.test +++ b/storage/tokudb/mysql-test/tokudb/t/card_scale_percent.test @@ -30,20 +30,18 @@ set session tokudb_analyze_throttle=0; -- enable_query_log -set global tokudb_cardinality_scale_percent = 10; analyze table tt; + +set global tokudb_cardinality_scale_percent = 10; show indexes from tt; set global tokudb_cardinality_scale_percent = 50; -analyze table tt; show indexes from tt; set global tokudb_cardinality_scale_percent = 100; -analyze table tt; show indexes from tt; set global tokudb_cardinality_scale_percent = 200; -analyze table tt; show indexes from tt; -- disable_query_log diff --git a/storage/tokudb/mysql-test/tokudb/t/locking-read-repeatable-read-1.test b/storage/tokudb/mysql-test/tokudb/t/locking-read-repeatable-read-1.test new file mode 100644 index 0000000000000000000000000000000000000000..c5ef0f0703e95dd885c7e6dcb783f0f67fbc825e --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/t/locking-read-repeatable-read-1.test @@ -0,0 +1,23 @@ +source include/have_tokudb.inc; +source include/count_sessions.inc; +create table t (a int primary key, b int) ENGINE=TokuDB; +insert into t values (1,0); +set session transaction isolation level repeatable read; +begin; +# t1 select in share mode +select * from t where a=1 lock in share mode; +# t2 update +connect(conn1,localhost,root); +set session transaction isolation level repeatable read; +begin; +# t2 select for update, should hang until t1 commits +send update t set b=b+1 where a=1; +--error ER_LOCK_WAIT_TIMEOUT +reap; +# t2 update +connection default; +commit; +disconnect conn1; +drop table t; + +source include/wait_until_count_sessions.inc; diff --git a/storage/tokudb/mysql-test/tokudb/t/locking-read-repeatable-read-2.test b/storage/tokudb/mysql-test/tokudb/t/locking-read-repeatable-read-2.test new file mode 100644 index 0000000000000000000000000000000000000000..20a4549c45f428d4a8120f0ab18ec61b530f06a4 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/t/locking-read-repeatable-read-2.test @@ -0,0 +1,29 @@ +#the difference of this test from locking-read-repeatable-read-1 +#is that this test is on range query(gap lock) which actually +#examines a different patch + +source include/have_tokudb.inc; +source include/count_sessions.inc; +create table t (a int primary key, b int) ENGINE=TokuDB; +insert into t values (1,0); +insert into t values (2,1); +insert into t values (3,2); +set session transaction isolation level repeatable read; +begin; +# t1 select in share mode +select * from t lock in share mode; +# t2 update +connect(conn1,localhost,root); +set session transaction isolation level repeatable read; +begin; +# t2 select for update, should hang until t1 commits +send update t set b=b+1 where a=2; +--error ER_LOCK_WAIT_TIMEOUT +reap; +# t2 update +connection default; +commit; +disconnect conn1; +drop table t; + +source include/wait_until_count_sessions.inc; diff --git a/storage/tokudb/mysql-test/tokudb/t/nonflushing_analyze_debug.test b/storage/tokudb/mysql-test/tokudb/t/nonflushing_analyze_debug.test new file mode 100644 index 0000000000000000000000000000000000000000..0c4c01b3dc0836e690e52ec95cb2e2fd0a115b8e --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb/t/nonflushing_analyze_debug.test @@ -0,0 +1,10 @@ +--source include/have_debug_sync.inc +--source include/have_tokudb.inc + +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=TokuDB; +INSERT INTO t1 VALUES (1), (2), (3); + +--let $percona_nonflushing_analyze_table= t1 +--source include/percona_nonflushing_analyze_debug.inc + +DROP TABLE t1; diff --git a/storage/tokudb/mysql-test/tokudb/t/row_format.test b/storage/tokudb/mysql-test/tokudb/t/row_format.test index 6533f8c06be9589c50a2e33cda52edb57f80d8e4..9c5c6e6403e723293e138c623146e83937121c0b 100644 --- a/storage/tokudb/mysql-test/tokudb/t/row_format.test +++ b/storage/tokudb/mysql-test/tokudb/t/row_format.test @@ -12,6 +12,27 @@ CREATE TABLE tokudb_row_format_test_6 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_LZ CREATE TABLE tokudb_row_format_test_7 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_QUICKLZ; CREATE TABLE tokudb_row_format_test_8 (a INT) ENGINE=TokuDB ROW_FORMAT=TOKUDB_SNAPPY; +# TDB-76 : CREATE TABLE ... LIKE ... does not use source row_format on target table +CREATE TABLE tdb76_1 LIKE tokudb_row_format_test_1; +CREATE TABLE tdb76_2 LIKE tokudb_row_format_test_2; +CREATE TABLE tdb76_3 LIKE tokudb_row_format_test_3; +CREATE TABLE tdb76_4 LIKE tokudb_row_format_test_4; +CREATE TABLE tdb76_5 LIKE tokudb_row_format_test_5; +CREATE TABLE tdb76_6 LIKE tokudb_row_format_test_6; +CREATE TABLE tdb76_7 LIKE tokudb_row_format_test_7; +CREATE TABLE tdb76_8 LIKE tokudb_row_format_test_8; + +CREATE TABLE tdb76_compact(a INT) ENGINE=TokuDB ROW_FORMAT=COMPACT; +CREATE TABLE tdb76_redundant(a INT) ENGINE=TokuDB ROW_FORMAT=REDUNDANT; +CREATE TABLE tdb76_dynamic(a INT) ENGINE=TokuDB ROW_FORMAT=DYNAMIC; +CREATE TABLE tdb76_compressed(a INT) ENGINE=TokuDB ROW_FORMAT=COMPRESSED; + +SELECT table_name, row_format, engine FROM information_schema.tables WHERE table_name like 'tdb76_%' ORDER BY table_name; + +DROP TABLE tdb76_1, tdb76_2, tdb76_3, tdb76_4, tdb76_5, tdb76_6, tdb76_7, tdb76_8, tdb76_compact, tdb76_redundant, tdb76_dynamic, tdb76_compressed; + + + SELECT table_name, row_format, engine FROM information_schema.tables WHERE table_name like 'tokudb_row_format_test%' ORDER BY table_name; ALTER TABLE tokudb_row_format_test_1 ENGINE=TokuDB ROW_FORMAT=TOKUDB_FAST; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result index 5ba5da217891f06923cb43c725038f56fb64aea8..caaa963c325ad7c6e5aeee447d8991c75a50bc56 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/db756_card_part_hash_1_pick.result @@ -17,5 +17,5 @@ test.t analyze status OK show indexes from t; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t 0 PRIMARY 1 id A 7 NULL NULL BTREE -t 1 x 1 x A 3 NULL NULL YES BTREE +t 1 x 1 x A 7 NULL NULL YES BTREE drop table t; diff --git a/storage/tokudb/mysql-test/tokudb_parts/disabled.def b/storage/tokudb/mysql-test/tokudb_parts/disabled.def index 3252a463176de963c4ce6bf119d6d85f4e4a1eaf..17a8ddcc12e8579d33b42492a17686ee129888f8 100644 --- a/storage/tokudb/mysql-test/tokudb_parts/disabled.def +++ b/storage/tokudb/mysql-test/tokudb_parts/disabled.def @@ -7,3 +7,4 @@ partition_max_sub_parts_key_list_tokudb: 5.6 test not merged yet partition_max_sub_parts_key_range_tokudb: 5.6 test not merged yet partition_max_sub_parts_list_tokudb: 5.6 test not merged yet partition_max_sub_parts_range_tokudb: 5.6 test not merged yet +nonflushing_analyze_debug: Freezes in MariaDB 10.0 diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/nonflushing_analyze_debug.result b/storage/tokudb/mysql-test/tokudb_parts/r/nonflushing_analyze_debug.result new file mode 100644 index 0000000000000000000000000000000000000000..5a7bfb369dffd53953a85c667484213a85fcf755 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_parts/r/nonflushing_analyze_debug.result @@ -0,0 +1,50 @@ +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=TokuDB +PARTITION BY RANGE (a) ( +PARTITION p0 VALUES LESS THAN (3), +PARTITION p1 VALUES LESS THAN (10)); +INSERT INTO t1 VALUES (1), (2), (3), (4); +SET DEBUG_SYNC="handler_ha_index_next_end SIGNAL idx_scan_in_progress WAIT_FOR finish_scan"; +SELECT * FROM t1; +SET DEBUG_SYNC="now WAIT_FOR idx_scan_in_progress"; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +SELECT * FROM t1; +a +1 +2 +3 +4 +SET DEBUG_SYNC="now SIGNAL finish_scan"; +a +1 +2 +3 +4 +DROP TABLE t1; +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=TokuDB +PARTITION BY RANGE (a) +SUBPARTITION BY HASH (A) +SUBPARTITIONS 2 ( +PARTITION p0 VALUES LESS THAN (3), +PARTITION p1 VALUES LESS THAN (10)); +INSERT INTO t2 VALUES (1), (2), (3), (4); +SET DEBUG_SYNC="handler_ha_index_next_end SIGNAL idx_scan_in_progress WAIT_FOR finish_scan"; +SELECT * FROM t2; +SET DEBUG_SYNC="now WAIT_FOR idx_scan_in_progress"; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status OK +SELECT * FROM t2; +a +2 +1 +4 +3 +SET DEBUG_SYNC="now SIGNAL finish_scan"; +a +2 +1 +4 +3 +DROP TABLE t2; diff --git a/storage/tokudb/mysql-test/tokudb_parts/t/nonflushing_analyze_debug.test b/storage/tokudb/mysql-test/tokudb_parts/t/nonflushing_analyze_debug.test new file mode 100644 index 0000000000000000000000000000000000000000..c99206acfe3ff187782d6600f27ab11d60530398 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_parts/t/nonflushing_analyze_debug.test @@ -0,0 +1,29 @@ +--source include/have_debug_sync.inc +--source include/have_tokudb.inc +--source include/have_partition.inc + +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=TokuDB + PARTITION BY RANGE (a) ( + PARTITION p0 VALUES LESS THAN (3), + PARTITION p1 VALUES LESS THAN (10)); + +INSERT INTO t1 VALUES (1), (2), (3), (4); + +--let $percona_nonflushing_analyze_table= t1 +--source include/percona_nonflushing_analyze_debug.inc + +DROP TABLE t1; + +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=TokuDB + PARTITION BY RANGE (a) + SUBPARTITION BY HASH (A) + SUBPARTITIONS 2 ( + PARTITION p0 VALUES LESS THAN (3), + PARTITION p1 VALUES LESS THAN (10)); + +INSERT INTO t2 VALUES (1), (2), (3), (4); + +--let $percona_nonflushing_analyze_table= t2 +--source include/percona_nonflushing_analyze_debug.inc + +DROP TABLE t2; diff --git a/storage/tokudb/mysql-test/tokudb_perfschema/r/crash_tokudb.result b/storage/tokudb/mysql-test/tokudb_perfschema/r/crash_tokudb.result new file mode 100644 index 0000000000000000000000000000000000000000..189d6bef14ed580345a1a33ea210c852787ab021 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_perfschema/r/crash_tokudb.result @@ -0,0 +1,30 @@ +SELECT COUNT(*) > 0 FROM performance_schema.setup_consumers +WHERE ENABLED = "NO"; +COUNT(*) > 0 +0 +SELECT COUNT(*) > 0 FROM performance_schema.setup_instruments +WHERE NAME LIKE "%/fti/%" AND (ENABLED = 'NO' OR TIMED = "NO"); +COUNT(*) > 0 +0 +CREATE TABLE t(a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE=TokuDB; +INSERT INTO t (b) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10), +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +INSERT INTO t (b) SELECT b FROM t; +UPDATE t SET b = 11 WHERE b = 10; +DELETE FROM t WHERE b = 1; +ALTER TABLE t ADD COLUMN c CHAR(10) default NULL; +TRUNCATE TABLE t; +RENAME TABLE t TO t1; +RENAME TABLE t1 TO t; +SELECT COUNT(*) > 0 FROM t; +COUNT(*) > 0 +0 +DROP TABLE t; diff --git a/storage/tokudb/mysql-test/tokudb_perfschema/r/start_server_tokudb.result b/storage/tokudb/mysql-test/tokudb_perfschema/r/start_server_tokudb.result new file mode 100644 index 0000000000000000000000000000000000000000..2e220916ec3641ee6fe8265a3cbff798c186d485 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_perfschema/r/start_server_tokudb.result @@ -0,0 +1,114 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +12 +select count(*) > 3 from performance_schema.setup_instruments; +count(*) > 3 +1 +select count(*) from performance_schema.setup_timers; +count(*) +4 +select * from performance_schema.accounts; +select * from performance_schema.cond_instances; +select * from performance_schema.events_stages_current; +select * from performance_schema.events_stages_history; +select * from performance_schema.events_stages_history_long; +select * from performance_schema.events_stages_summary_by_account_by_event_name; +select * from performance_schema.events_stages_summary_by_host_by_event_name; +select * from performance_schema.events_stages_summary_by_thread_by_event_name; +select * from performance_schema.events_stages_summary_by_user_by_event_name; +select * from performance_schema.events_stages_summary_global_by_event_name; +select * from performance_schema.events_statements_current; +select * from performance_schema.events_statements_history; +select * from performance_schema.events_statements_history_long; +select * from performance_schema.events_statements_summary_by_account_by_event_name; +select * from performance_schema.events_statements_summary_by_digest; +select * from performance_schema.events_statements_summary_by_host_by_event_name; +select * from performance_schema.events_statements_summary_by_thread_by_event_name; +select * from performance_schema.events_statements_summary_by_user_by_event_name; +select * from performance_schema.events_statements_summary_global_by_event_name; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_account_by_event_name; +select * from performance_schema.events_waits_summary_by_host_by_event_name; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_by_user_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.host_cache; +select * from performance_schema.hosts; +select * from performance_schema.mutex_instances; +select * from performance_schema.objects_summary_global_by_type; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.session_account_connect_attrs; +select * from performance_schema.session_connect_attrs; +select * from performance_schema.setup_actors; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_objects; +select * from performance_schema.setup_timers; +select * from performance_schema.socket_instances; +select * from performance_schema.socket_summary_by_instance; +select * from performance_schema.socket_summary_by_event_name; +select * from performance_schema.table_io_waits_summary_by_index_usage; +select * from performance_schema.table_io_waits_summary_by_table; +select * from performance_schema.table_lock_waits_summary_by_table; +select * from performance_schema.threads; +select * from performance_schema.users; +show variables where +`Variable_name` != "performance_schema_max_statement_classes" and +`Variable_name` like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_accounts_size 100 +performance_schema_digests_size 200 +performance_schema_events_stages_history_long_size 1000 +performance_schema_events_stages_history_size 10 +performance_schema_events_statements_history_long_size 1000 +performance_schema_events_statements_history_size 10 +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_hosts_size 100 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_digest_length 1024 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 5000 +performance_schema_max_rwlock_classes 40 +performance_schema_max_rwlock_instances 5000 +performance_schema_max_socket_classes 10 +performance_schema_max_socket_instances 1000 +performance_schema_max_stage_classes 150 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 200 +performance_schema_session_connect_attrs_size 2048 +performance_schema_setup_actors_size 100 +performance_schema_setup_objects_size 100 +performance_schema_users_size 100 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +SELECT COUNT(NAME) > 0 FROM performance_schema.setup_instruments WHERE NAME LIKE "%/fti/%"; +COUNT(NAME) > 0 +1 +SELECT COUNT(NAME) > 0 FROM performance_schema.threads WHERE NAME LIKE "%kibbutz%"; +COUNT(NAME) > 0 +1 diff --git a/storage/tokudb/mysql-test/tokudb_perfschema/t/crash_tokudb.test b/storage/tokudb/mysql-test/tokudb_perfschema/t/crash_tokudb.test new file mode 100644 index 0000000000000000000000000000000000000000..31757a202590f79c64c1d55f252ac384573f292d --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_perfschema/t/crash_tokudb.test @@ -0,0 +1,36 @@ +# TokuDB PFS crash test: +# Make sure FTI instrumentation is on, execute base DDL, DML queries +# and make sure there is no crash. + +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source include/have_tokudb.inc + +SELECT COUNT(*) > 0 FROM performance_schema.setup_consumers + WHERE ENABLED = "NO"; +SELECT COUNT(*) > 0 FROM performance_schema.setup_instruments + WHERE NAME LIKE "%/fti/%" AND (ENABLED = 'NO' OR TIMED = "NO"); + +CREATE TABLE t(a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE=TokuDB; +INSERT INTO t (b) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), + (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +INSERT INTO t (b) SELECT b FROM t; + +UPDATE t SET b = 11 WHERE b = 10; +DELETE FROM t WHERE b = 1; + +ALTER TABLE t ADD COLUMN c CHAR(10) default NULL; +TRUNCATE TABLE t; +RENAME TABLE t TO t1; +RENAME TABLE t1 TO t; + +SELECT COUNT(*) > 0 FROM t; +DROP TABLE t; diff --git a/storage/tokudb/mysql-test/tokudb_perfschema/t/start_server_tokudb.test b/storage/tokudb/mysql-test/tokudb_perfschema/t/start_server_tokudb.test new file mode 100644 index 0000000000000000000000000000000000000000..4034fba05497fb187222b8716856e63be759e115 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_perfschema/t/start_server_tokudb.test @@ -0,0 +1,10 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc +--source include/have_tokudb.inc + +--source ../../perfschema/include/start_server_common.inc + +SELECT COUNT(NAME) > 0 FROM performance_schema.setup_instruments WHERE NAME LIKE "%/fti/%"; +SELECT COUNT(NAME) > 0 FROM performance_schema.threads WHERE NAME LIKE "%kibbutz%"; diff --git a/storage/tokudb/mysql-test/tokudb_perfschema/t/suite.opt b/storage/tokudb/mysql-test/tokudb_perfschema/t/suite.opt new file mode 100644 index 0000000000000000000000000000000000000000..6d826fe91d1b590d4e6deaad5c34dd72195382f1 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_perfschema/t/suite.opt @@ -0,0 +1 @@ +--loose-enable-performance-schema $TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/tokudb_background.cc b/storage/tokudb/tokudb_background.cc index e019e41c7882470a45c6f2780a4934d61e3a6120..13e0e9321cc211a4762f69f6f20c339fe889595d 100644 --- a/storage/tokudb/tokudb_background.cc +++ b/storage/tokudb/tokudb_background.cc @@ -66,13 +66,13 @@ void job_manager_t::destroy() { _sem.set_interrupt(); while (_background_jobs.size()) { - _mutex.lock(); + mutex_t_lock(_mutex); job_t* job = _background_jobs.front(); if (!job->cancelled()) cancel(job); _background_jobs.pop_front(); delete job; - _mutex.unlock(); + mutex_t_unlock(_mutex); } void* result; @@ -83,7 +83,7 @@ bool job_manager_t::run_job(job_t* newjob, bool background) { bool ret = false; const char* jobkey = newjob->key(); - _mutex.lock(); + mutex_t_lock(_mutex); assert_always(!_shutdown); for (jobs_t::iterator it = _background_jobs.begin(); @@ -138,15 +138,16 @@ bool job_manager_t::run_job(job_t* newjob, bool background) { } cleanup: - _mutex.unlock(); + mutex_t_unlock(_mutex); return ret; } bool job_manager_t::cancel_job(const char* key) { bool ret = false; - _mutex.lock(); + mutex_t_lock(_mutex); for (jobs_t::iterator it = _background_jobs.begin(); - it != _background_jobs.end(); it++) { + it != _background_jobs.end(); + it++) { job_t* job = *it; if (!job->cancelled() && strcmp(job->key(), key) == 0) { @@ -155,12 +156,11 @@ bool job_manager_t::cancel_job(const char* key) { } } - _mutex.unlock(); + mutex_t_unlock(_mutex); return ret; } void job_manager_t::iterate_jobs(pfn_iterate_t callback, void* extra) const { - - _mutex.lock(); + mutex_t_lock(_mutex); for (jobs_t::const_iterator it = _background_jobs.begin(); it != _background_jobs.end(); @@ -171,7 +171,7 @@ void job_manager_t::iterate_jobs(pfn_iterate_t callback, void* extra) const { } } - _mutex.unlock(); + mutex_t_unlock(_mutex); } void* job_manager_t::thread_func(void* v) { return ((tokudb::background::job_manager_t*)v)->real_thread_func(); @@ -189,14 +189,14 @@ void* job_manager_t::real_thread_func() { tokudb::time::sleep_microsec(250000); continue; } -#endif // TOKUDB_DEBUG +#endif // TOKUDB_DEBUG - _mutex.lock(); + mutex_t_lock(_mutex); assert_debug(_background_jobs.size() > 0); job_t* job = _background_jobs.front(); run(job); _background_jobs.pop_front(); - _mutex.unlock(); + mutex_t_unlock(_mutex); delete job; } } @@ -205,11 +205,11 @@ void* job_manager_t::real_thread_func() { void job_manager_t::run(job_t* job) { assert_debug(_mutex.is_owned_by_me()); if (!job->cancelled()) { - _mutex.unlock(); + mutex_t_unlock(_mutex); // do job job->run(); // done job - _mutex.lock(); + mutex_t_lock(_mutex); } if (!job->cancelled()) { job->destroy(); diff --git a/storage/tokudb/tokudb_background.h b/storage/tokudb/tokudb_background.h index 29991ab325d543ba58169ccfa72f07c317573588..bf5eb97a6191bf8edf4e8ed46a82f791682e9e27 100644 --- a/storage/tokudb/tokudb_background.h +++ b/storage/tokudb/tokudb_background.h @@ -174,11 +174,11 @@ bool destroy(); inline void job_manager_t::lock() { assert_debug(!_mutex.is_owned_by_me()); - _mutex.lock(); + mutex_t_lock(_mutex); } inline void job_manager_t::unlock() { assert_debug(_mutex.is_owned_by_me()); - _mutex.unlock(); + mutex_t_unlock(_mutex); } inline void job_manager_t::job_t::run() { diff --git a/storage/tokudb/tokudb_information_schema.cc b/storage/tokudb/tokudb_information_schema.cc index 5cd0609ac74feedbf663ba0d7150d823127c3578..bb263d5f960dd2fa2d87cfb7c672247ee90635a7 100644 --- a/storage/tokudb/tokudb_information_schema.cc +++ b/storage/tokudb/tokudb_information_schema.cc @@ -99,7 +99,7 @@ int trx_fill_table(THD* thd, TABLE_LIST* tables, COND* cond) { TOKUDB_DBUG_ENTER(""); int error; - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; @@ -234,7 +234,7 @@ int lock_waits_fill_table(THD* thd, TABLE_LIST* tables, COND* cond) { TOKUDB_DBUG_ENTER(""); int error; - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; @@ -377,7 +377,7 @@ int locks_fill_table(THD* thd, TABLE_LIST* tables, COND* cond) { TOKUDB_DBUG_ENTER(""); int error; - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; @@ -521,7 +521,7 @@ int file_map_fill_table(THD* thd, TABLE_LIST* tables, COND* cond) { int error; TABLE* table = tables->table; - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; @@ -728,7 +728,7 @@ int fractal_tree_info_fill_table(THD* thd, TABLE_LIST* tables, COND* cond) { // 3938: Get a read lock on the status flag, since we must // read it before safely proceeding - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; @@ -1025,7 +1025,7 @@ int fractal_tree_block_map_fill_table( // 3938: Get a read lock on the status flag, since we must // read it before safely proceeding - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; @@ -1162,7 +1162,7 @@ int background_job_status_fill_table(THD *thd, TABLE_LIST *tables, COND *cond) { int error; TABLE* table = tables->table; - tokudb_hton_initialized_lock.lock_read(); + rwlock_t_lock_read(tokudb_hton_initialized_lock); if (!tokudb_hton_initialized) { error = ER_PLUGIN_IS_NOT_LOADED; diff --git a/storage/tokudb/tokudb_thread.cc b/storage/tokudb/tokudb_thread.cc index f27e803a0655fb242f211cc7804c232d430c7064..6fc1191975dc46725f69656e9dee60f38e658f8a 100644 --- a/storage/tokudb/tokudb_thread.cc +++ b/storage/tokudb/tokudb_thread.cc @@ -29,6 +29,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. namespace tokudb { namespace thread { +const pfs_key_t pfs_not_instrumented = 0xFFFFFFFF; pthread_t mutex_t::_null_owner = 0; } // namespace thread diff --git a/storage/tokudb/tokudb_thread.h b/storage/tokudb/tokudb_thread.h index dcb1fd6ec635b897176f4bc13ae324b7994925f0..dec58f3fd355269cf3f7dcee6d1f0446492159f9 100644 --- a/storage/tokudb/tokudb_thread.h +++ b/storage/tokudb/tokudb_thread.h @@ -34,95 +34,68 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. namespace tokudb { namespace thread { -#if (defined(__MACH__) || defined(__APPLE__)) && _POSIX_TIMERS <= 0 - -#define _x_min(a, b) ((a) < (b) ? (a) : (b)) - -#define timed_lock_define(timed_func_name, lock_type_name, lock_func_name) \ -inline int timed_func_name(lock_type_name *mutex, \ - const struct timespec *abs_timeout) { \ - int pthread_rc; \ - struct timespec remaining, slept, ts; \ - static const int sleep_step = 1000000; \ - \ - remaining = *abs_timeout; \ - while ((pthread_rc = lock_func_name(mutex)) == EBUSY) { \ - ts.tv_sec = 0; \ - ts.tv_nsec = (remaining.tv_sec > 0 ? \ - sleep_step : \ - _x_min(remaining.tv_nsec,sleep_step)); \ - nanosleep(&ts, &slept); \ - ts.tv_nsec -= slept.tv_nsec; \ - if (ts.tv_nsec <= remaining.tv_nsec) { \ - remaining.tv_nsec -= ts.tv_nsec; \ - } else { \ - remaining.tv_sec--; \ - remaining.tv_nsec = \ - (sleep_step - (ts.tv_nsec - remaining.tv_nsec)); \ - } \ - if (remaining.tv_sec < 0 || \ - (!remaining.tv_sec && remaining.tv_nsec <= 0)) { \ - return ETIMEDOUT; \ - } \ - } \ - \ - return pthread_rc; \ -} - -timed_lock_define(pthread_mutex_timedlock, - pthread_mutex_t, - pthread_mutex_trylock); - -timed_lock_define(pthread_rwlock_timedrdlock, - pthread_rwlock_t, - pthread_rwlock_tryrdlock); - -timed_lock_define(pthread_rwlock_timedwrlock, - pthread_rwlock_t, - pthread_rwlock_trywrlock); - -#endif //(defined(__MACH__) || defined(__APPLE__)) && _POSIX_TIMERS <= 0 +extern const pfs_key_t pfs_not_instrumented; uint my_tid(void); // Your basic mutex class mutex_t { public: - mutex_t(void); + explicit mutex_t(pfs_key_t key); + mutex_t(void) : mutex_t(pfs_not_instrumented) {} ~mutex_t(void); - void lock(void); - int lock(ulonglong microseconds); - void unlock(void); + void reinit(pfs_key_t key); + void lock( +#ifdef HAVE_PSI_MUTEX_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_MUTEX_INTERFACE + ); + void unlock( +#ifdef HAVE_PSI_MUTEX_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_MUTEX_INTERFACE + ); #ifdef TOKUDB_DEBUG bool is_owned_by_me(void) const; #endif private: static pthread_t _null_owner; - pthread_mutex_t _mutex; + mysql_mutex_t _mutex; #ifdef TOKUDB_DEBUG - uint _owners; - pthread_t _owner; + uint _owners; + pthread_t _owner; #endif }; // Simple read write lock class rwlock_t { public: - rwlock_t(void); + explicit rwlock_t(pfs_key_t key); + rwlock_t(void) : rwlock_t(pfs_not_instrumented) {} ~rwlock_t(void); - void lock_read(void); - int lock_read(ulonglong microseconds); - void lock_write(void); - int lock_write(ulonglong microseconds); + void lock_read( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_RWLOCK_INTERFACE + ); + void lock_write( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_RWLOCK_INTERFACE + ); void unlock(void); private: rwlock_t(const rwlock_t&); rwlock_t& operator=(const rwlock_t&); - pthread_rwlock_t _rwlock; + mysql_rwlock_t _rwlock; }; // Simple event signal/wait class @@ -224,57 +197,76 @@ class thread_t { pthread_t _thread; }; +inline uint my_tid(void) { return (uint)toku_os_gettid(); } -inline uint my_tid(void) { - return (uint)toku_os_gettid(); -} - - -inline mutex_t::mutex_t(void) { - #ifdef TOKUDB_DEBUG - _owners = 0; - _owner = _null_owner; - #endif - int r = pthread_mutex_init(&_mutex, MY_MUTEX_INIT_FAST); +inline mutex_t::mutex_t(pfs_key_t key) { +#ifdef TOKUDB_DEBUG + _owners = 0; + _owner = _null_owner; +#endif + int r MY_ATTRIBUTE((unused)) = mysql_mutex_init(key, &_mutex, MY_MUTEX_INIT_FAST); assert_debug(r == 0); } inline mutex_t::~mutex_t(void) { - #ifdef TOKUDB_DEBUG - assert_debug(_owners == 0); - #endif - int r = pthread_mutex_destroy(&_mutex); +#ifdef TOKUDB_DEBUG + assert_debug(_owners == 0); +#endif + int r MY_ATTRIBUTE((unused)) = mysql_mutex_destroy(&_mutex); assert_debug(r == 0); } -inline void mutex_t::lock(void) { - assert_debug(is_owned_by_me() == false); - int r = pthread_mutex_lock(&_mutex); +inline void mutex_t::reinit(pfs_key_t key) { +#ifdef TOKUDB_DEBUG + assert_debug(_owners == 0); +#endif + int r MY_ATTRIBUTE((unused)); + r = mysql_mutex_destroy(&_mutex); + assert_debug(r == 0); + r = mysql_mutex_init(key, &_mutex, MY_MUTEX_INIT_FAST); assert_debug(r == 0); - #ifdef TOKUDB_DEBUG - _owners++; - _owner = pthread_self(); - #endif } -inline int mutex_t::lock(ulonglong microseconds) { +inline void mutex_t::lock( +#ifdef HAVE_PSI_MUTEX_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_MUTEX_INTERFACE + ) { assert_debug(is_owned_by_me() == false); - timespec waittime = time::offset_timespec(microseconds); - int r = pthread_mutex_timedlock(&_mutex, &waittime); - #ifdef TOKUDB_DEBUG - if (r == 0) { - _owners++; - _owner = pthread_self(); - } - #endif - assert_debug(r == 0 || r == ETIMEDOUT); - return r; + int r MY_ATTRIBUTE((unused)) = inline_mysql_mutex_lock(&_mutex +#ifdef HAVE_PSI_MUTEX_INTERFACE + , + src_file, + src_line +#endif // HAVE_PSI_MUTEX_INTERFACE + ); + assert_debug(r == 0); +#ifdef TOKUDB_DEBUG + _owners++; + _owner = pthread_self(); +#endif } -inline void mutex_t::unlock(void) { - #ifdef TOKUDB_DEBUG - assert_debug(_owners > 0); - assert_debug(is_owned_by_me()); - _owners--; - _owner = _null_owner; - #endif - int r = pthread_mutex_unlock(&_mutex); +inline void mutex_t::unlock( +#ifdef HAVE_PSI_MUTEX_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_MUTEX_INTERFACE + ) { +#ifndef SAFE_MUTEX + (void)(src_file); + (void)(src_line); +#endif // SAFE_MUTEX +#ifdef TOKUDB_DEBUG + assert_debug(_owners > 0); + assert_debug(is_owned_by_me()); + _owners--; + _owner = _null_owner; +#endif + int r MY_ATTRIBUTE((unused)) = inline_mysql_mutex_unlock(&_mutex +#ifdef SAFE_MUTEX + , + src_file, + src_line +#endif // SAFE_MUTEX + ); assert_debug(r == 0); } #ifdef TOKUDB_DEBUG @@ -283,44 +275,28 @@ inline bool mutex_t::is_owned_by_me(void) const { } #endif - -inline rwlock_t::rwlock_t(void) { - int r = pthread_rwlock_init(&_rwlock, NULL); +inline rwlock_t::rwlock_t(pfs_key_t key) { + int r MY_ATTRIBUTE((unused)) = mysql_rwlock_init(key, &_rwlock); assert_debug(r == 0); } inline rwlock_t::~rwlock_t(void) { - int r = pthread_rwlock_destroy(&_rwlock); - assert_debug(r == 0); -} -inline void rwlock_t::lock_read(void) { - int r; - while ((r = pthread_rwlock_rdlock(&_rwlock)) != 0) { - if (r == EBUSY || r == EAGAIN) { - time::sleep_microsec(1000); - continue; - } - break; - } - assert_debug(r == 0); -} -inline int rwlock_t::lock_read(ulonglong microseconds) { - int r; - timespec waittime = time::offset_timespec(microseconds); - while ((r = pthread_rwlock_timedrdlock(&_rwlock, &waittime)) != 0) { - if (r == EBUSY || r == EAGAIN) { - time::sleep_microsec(1000); - continue; - } else if (r == ETIMEDOUT) { - return ETIMEDOUT; - } - break; - } + int r MY_ATTRIBUTE((unused)) = mysql_rwlock_destroy(&_rwlock); assert_debug(r == 0); - return r; } -inline void rwlock_t::lock_write(void) { +inline void rwlock_t::lock_read( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_RWLOCK_INTERFACE + ) { int r; - while ((r = pthread_rwlock_wrlock(&_rwlock)) != 0) { + while ((r = inline_mysql_rwlock_rdlock(&_rwlock +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , + src_file, + src_line +#endif // HAVE_PSI_RWLOCK_INTERFACE + )) != 0) { if (r == EBUSY || r == EAGAIN) { time::sleep_microsec(1000); continue; @@ -329,27 +305,33 @@ inline void rwlock_t::lock_write(void) { } assert_debug(r == 0); } -inline int rwlock_t::lock_write(ulonglong microseconds) { +inline void rwlock_t::lock_write( +#ifdef HAVE_PSI_RWLOCK_INTERFACE + const char* src_file, + uint src_line +#endif // HAVE_PSI_RWLOCK_INTERFACE + ) { int r; - timespec waittime = time::offset_timespec(microseconds); - while ((r = pthread_rwlock_timedwrlock(&_rwlock, &waittime)) != 0) { + while ((r = inline_mysql_rwlock_wrlock(&_rwlock +#ifdef HAVE_PSI_RWLOCK_INTERFACE + , + src_file, + src_line +#endif // HAVE_PSI_RWLOCK_INTERFACE + )) != 0) { if (r == EBUSY || r == EAGAIN) { time::sleep_microsec(1000); continue; - } else if (r == ETIMEDOUT) { - return ETIMEDOUT; } break; } assert_debug(r == 0); - return r; } inline void rwlock_t::unlock(void) { - int r = pthread_rwlock_unlock(&_rwlock); + int r MY_ATTRIBUTE((unused)) = mysql_rwlock_unlock(&_rwlock); assert_debug(r == 0); } -inline rwlock_t::rwlock_t(const rwlock_t&) { -} +inline rwlock_t::rwlock_t(const rwlock_t&) {} inline rwlock_t& rwlock_t::operator=(const rwlock_t&) { return *this; } @@ -358,7 +340,7 @@ inline rwlock_t& rwlock_t::operator=(const rwlock_t&) { inline event_t::event_t(bool create_signalled, bool manual_reset) : _manual_reset(manual_reset) { - int r = pthread_mutex_init(&_mutex, NULL); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_init(&_mutex, NULL); assert_debug(r == 0); r = pthread_cond_init(&_cond, NULL); assert_debug(r == 0); @@ -370,13 +352,13 @@ inline event_t::event_t(bool create_signalled, bool manual_reset) : _pulsed = false; } inline event_t::~event_t(void) { - int r = pthread_mutex_destroy(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_destroy(&_mutex); assert_debug(r == 0); r = pthread_cond_destroy(&_cond); assert_debug(r == 0); } inline void event_t::wait(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); while (_signalled == false && _pulsed == false) { r = pthread_cond_wait(&_cond, &_mutex); @@ -413,7 +395,7 @@ inline int event_t::wait(ulonglong microseconds) { return 0; } inline void event_t::signal(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); _signalled = true; if (_manual_reset) { @@ -427,7 +409,7 @@ inline void event_t::signal(void) { assert_debug(r == 0); } inline void event_t::pulse(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); _pulsed = true; r = pthread_cond_signal(&_cond); @@ -437,7 +419,7 @@ inline void event_t::pulse(void) { } inline bool event_t::signalled(void) { bool ret = false; - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); ret = _signalled; r = pthread_mutex_unlock(&_mutex); @@ -445,7 +427,7 @@ inline bool event_t::signalled(void) { return ret; } inline void event_t::reset(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); _signalled = false; _pulsed = false; @@ -467,21 +449,21 @@ inline semaphore_t::semaphore_t( _initial_count(initial_count), _max_count(max_count) { - int r = pthread_mutex_init(&_mutex, NULL); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_init(&_mutex, NULL); assert_debug(r == 0); r = pthread_cond_init(&_cond, NULL); assert_debug(r == 0); _signalled = _initial_count; } inline semaphore_t::~semaphore_t(void) { - int r = pthread_mutex_destroy(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_destroy(&_mutex); assert_debug(r == 0); r = pthread_cond_destroy(&_cond); assert_debug(r == 0); } inline semaphore_t::E_WAIT semaphore_t::wait(void) { E_WAIT ret; - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); while (_signalled == 0 && _interrupted == false) { r = pthread_cond_wait(&_cond, &_mutex); @@ -524,7 +506,7 @@ inline semaphore_t::E_WAIT semaphore_t::wait(ulonglong microseconds) { } inline bool semaphore_t::signal(void) { bool ret = false; - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); if (_signalled < _max_count) { _signalled++; @@ -538,7 +520,7 @@ inline bool semaphore_t::signal(void) { } inline int semaphore_t::signalled(void) { int ret = 0; - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); ret = _signalled; r = pthread_mutex_unlock(&_mutex); @@ -546,7 +528,7 @@ inline int semaphore_t::signalled(void) { return ret; } inline void semaphore_t::reset(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); _signalled = 0; r = pthread_mutex_unlock(&_mutex); @@ -554,7 +536,7 @@ inline void semaphore_t::reset(void) { return; } inline void semaphore_t::set_interrupt(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); _interrupted = true; r = pthread_cond_broadcast(&_cond); @@ -563,7 +545,7 @@ inline void semaphore_t::set_interrupt(void) { assert_debug(r == 0); } inline void semaphore_t::clear_interrupt(void) { - int r = pthread_mutex_lock(&_mutex); + int r MY_ATTRIBUTE((unused)) = pthread_mutex_lock(&_mutex); assert_debug(r == 0); _interrupted = false; r = pthread_mutex_unlock(&_mutex); diff --git a/storage/xtradb/api/api0api.cc b/storage/xtradb/api/api0api.cc index 1abb0b2bdd1d94af3b235afd17641f42c32f203e..55ed555ed48961e36c91187b82fe09d4d1772afd 100644 --- a/storage/xtradb/api/api0api.cc +++ b/storage/xtradb/api/api0api.cc @@ -398,7 +398,7 @@ ib_read_tuple( data = btr_rec_copy_externally_stored_field( copy, offsets, zip_size, i, &len, - tuple->heap, NULL); + tuple->heap); ut_a(len != UNIV_SQL_NULL); } diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc index f22871deb3211322740e136bc6be32a5990d05de..e29d9091f8e967d814af1d6554cef4b5eff944ac 100644 --- a/storage/xtradb/btr/btr0cur.cc +++ b/storage/xtradb/btr/btr0cur.cc @@ -3991,7 +3991,6 @@ static const ib_int64_t rows_in_range_arbitrary_ret_val = 10; @param[in] mode1 search mode for range start @param[in] tuple2 range end, may also be empty tuple @param[in] mode2 search mode for range end -@param[in] trx trx @param[in] nth_attempt if the tree gets modified too much while we are trying to analyze it, then we will retry (this function will call itself, incrementing this parameter) @@ -4008,7 +4007,6 @@ btr_estimate_n_rows_in_range_low( ulint mode1, const dtuple_t* tuple2, ulint mode2, - trx_t* trx, unsigned nth_attempt) { btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS]; @@ -4027,7 +4025,7 @@ btr_estimate_n_rows_in_range_low( table_n_rows = dict_table_get_n_rows(index->table); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); cursor.path_arr = path1; @@ -4049,7 +4047,7 @@ btr_estimate_n_rows_in_range_low( return (0); } - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); #ifdef UNIV_DEBUG if (!strcmp(index->name, "iC")) { @@ -4144,7 +4142,7 @@ btr_estimate_n_rows_in_range_low( const ib_int64_t ret = btr_estimate_n_rows_in_range_low( index, tuple1, mode1, - tuple2, mode2, trx, + tuple2, mode2, nth_attempt + 1); return(ret); @@ -4205,7 +4203,6 @@ btr_estimate_n_rows_in_range_low( @param[in] mode1 search mode for range start @param[in] tuple2 range end, may also be empty tuple @param[in] mode2 search mode for range end -@param[in] trx trx @return estimated number of rows */ ib_int64_t btr_estimate_n_rows_in_range( @@ -4213,11 +4210,10 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple1, ulint mode1, const dtuple_t* tuple2, - ulint mode2, - trx_t* trx) + ulint mode2) { const ib_int64_t ret = btr_estimate_n_rows_in_range_low( - index, tuple1, mode1, tuple2, mode2, trx, + index, tuple1, mode1, tuple2, mode2, 1 /* first attempt */); return(ret); @@ -5757,8 +5753,7 @@ btr_copy_blob_prefix( ulint len, /*!< in: length of buf, in bytes */ ulint space_id,/*!< in: space id of the BLOB pages */ ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset, /*!< in: offset on the first BLOB page */ - trx_t* trx) /*!< in: transaction handle */ + ulint offset) /*!< in: offset on the first BLOB page */ { ulint copied_len = 0; @@ -5770,7 +5765,7 @@ btr_copy_blob_prefix( ulint part_len; ulint copy_len; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr); buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE); @@ -5973,8 +5968,7 @@ btr_copy_externally_stored_field_prefix_low( zero for uncompressed BLOBs */ ulint space_id,/*!< in: space id of the first BLOB page */ ulint page_no,/*!< in: page number of the first BLOB page */ - ulint offset, /*!< in: offset on the first BLOB page */ - trx_t* trx) /*!< in: transaction handle */ + ulint offset) /*!< in: offset on the first BLOB page */ { if (UNIV_UNLIKELY(len == 0)) { return(0); @@ -5985,7 +5979,7 @@ btr_copy_externally_stored_field_prefix_low( space_id, page_no, offset)); } else { return(btr_copy_blob_prefix(buf, len, space_id, - page_no, offset, trx)); + page_no, offset)); } } @@ -6006,8 +6000,7 @@ btr_copy_externally_stored_field_prefix( field containing also the reference to the external part; must be protected by a lock or a page latch */ - ulint local_len,/*!< in: length of data, in bytes */ - trx_t* trx) /*!< in: transaction handle */ + ulint local_len)/*!< in: length of data, in bytes */ { ulint space_id; ulint page_no; @@ -6046,7 +6039,7 @@ btr_copy_externally_stored_field_prefix( len - local_len, zip_size, space_id, page_no, - offset, trx)); + offset)); } /*******************************************************************//** @@ -6065,8 +6058,7 @@ btr_copy_externally_stored_field( ulint zip_size,/*!< in: nonzero=compressed BLOB page size, zero for uncompressed BLOBs */ ulint local_len,/*!< in: length of data */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx) /*!< in: transaction handle */ + mem_heap_t* heap) /*!< in: mem heap */ { ulint space_id; ulint page_no; @@ -6097,8 +6089,7 @@ btr_copy_externally_stored_field( extern_len, zip_size, space_id, - page_no, offset, - trx); + page_no, offset); return(buf); } @@ -6117,8 +6108,7 @@ btr_rec_copy_externally_stored_field( zero for uncompressed BLOBs */ ulint no, /*!< in: field number */ ulint* len, /*!< out: length of the field */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx) /*!< in: transaction handle */ + mem_heap_t* heap) /*!< in: mem heap */ { ulint local_len; const byte* data; @@ -6149,7 +6139,6 @@ btr_rec_copy_externally_stored_field( } return(btr_copy_externally_stored_field(len, data, - zip_size, local_len, heap, - trx)); + zip_size, local_len, heap)); } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/xtradb/btr/btr0pcur.cc b/storage/xtradb/btr/btr0pcur.cc index 0b970e1cf492ac8f52e5ed6cbd52fe7efee83819..06166e1aa16f8526a60478b1b5ff298bca1211da 100644 --- a/storage/xtradb/btr/btr0pcur.cc +++ b/storage/xtradb/btr/btr0pcur.cc @@ -33,6 +33,7 @@ Created 2/23/1996 Heikki Tuuri #include "rem0cmp.h" #include "trx0trx.h" #include "srv0srv.h" + /**************************************************************//** Allocates memory for a persistent cursor object and initializes the cursor. @return own: persistent cursor */ @@ -511,7 +512,7 @@ btr_pcur_move_backward_from_page( mtr_commit(mtr); - mtr_start_trx(mtr, mtr->trx); + mtr_start(mtr); btr_pcur_restore_position(latch_mode2, cursor, mtr); diff --git a/storage/xtradb/buf/buf0buddy.cc b/storage/xtradb/buf/buf0buddy.cc index 2ee39c6c992799ece85edbbdebb3ae32b4e46b72..1c50e71e68756dcf490729274a5429e83c4ea23b 100644 --- a/storage/xtradb/buf/buf0buddy.cc +++ b/storage/xtradb/buf/buf0buddy.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -667,7 +668,7 @@ buf_buddy_free_low( ut_ad(buf_pool->buddy_stat[i].used > 0); buf_pool->buddy_stat[i].used--; recombine: - UNIV_MEM_ASSERT_AND_ALLOC(buf, BUF_BUDDY_LOW << i); + UNIV_MEM_ALLOC(buf, BUF_BUDDY_LOW << i); if (i == BUF_BUDDY_SIZES) { mutex_exit(&buf_pool->zip_free_mutex); diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc index c71d45009e4561654b307f5fd392aec6a56c05b6..7bf423ed7405493ec6b0954aa21ea6fd09b8ebde 100644 --- a/storage/xtradb/buf/buf0lru.cc +++ b/storage/xtradb/buf/buf0lru.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -87,6 +87,10 @@ buffer pools. */ frames in the buffer pool, we set this to TRUE */ static ibool buf_lru_switched_on_innodb_mon = FALSE; +/** True if diagnostic message about difficult to find free blocks +in the buffer bool has already printed. */ +static bool buf_lru_free_blocks_error_printed; + /******************************************************************//** These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O and page_zip_decompress() operations. Based on the statistics, @@ -1080,68 +1084,39 @@ buf_LRU_check_size_of_non_data_objects( } /** Diagnose failure to get a free page and request InnoDB monitor output in -the error log if more than two seconds have been spent already. +the error log if it has not yet printed. @param[in] n_iterations how many buf_LRU_get_free_page iterations already completed -@param[in] started_ms timestamp in ms of when the attempt to get the - free page started @param[in] flush_failures how many times single-page flush, if allowed, has failed -@param[out] mon_value_was previous srv_print_innodb_monitor value -@param[out] started_monitor whether InnoDB monitor print has been requested */ static void -buf_LRU_handle_lack_of_free_blocks(ulint n_iterations, ulint started_ms, - ulint flush_failures, - ibool *mon_value_was, - ibool *started_monitor) +buf_LRU_handle_lack_of_free_blocks( + ulint n_iterations, + ulint flush_failures) { - static ulint last_printout_ms = 0; - - /* Legacy algorithm started warning after at least 2 seconds, we - emulate this. */ - const ulint current_ms = ut_time_ms(); - - if ((current_ms > started_ms + 2000) - && (current_ms > last_printout_ms + 2000)) { - - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Warning: difficult to find free blocks in\n" - "InnoDB: the buffer pool (%lu search iterations)!\n" - "InnoDB: %lu failed attempts to flush a page!" - " Consider\n" - "InnoDB: increasing the buffer pool size.\n" - "InnoDB: It is also possible that" - " in your Unix version\n" - "InnoDB: fsync is very slow, or" - " completely frozen inside\n" - "InnoDB: the OS kernel. Then upgrading to" - " a newer version\n" - "InnoDB: of your operating system may help." - " Look at the\n" - "InnoDB: number of fsyncs in diagnostic info below.\n" - "InnoDB: Pending flushes (fsync) log: %lu;" - " buffer pool: %lu\n" - "InnoDB: %lu OS file reads, %lu OS file writes," - " %lu OS fsyncs\n" - "InnoDB: Starting InnoDB Monitor to print further\n" - "InnoDB: diagnostics to the standard output.\n", - (ulong) n_iterations, - (ulong) flush_failures, - (ulong) fil_n_pending_log_flushes, - (ulong) fil_n_pending_tablespace_flushes, - (ulong) os_n_file_reads, (ulong) os_n_file_writes, - (ulong) os_n_fsyncs); - - last_printout_ms = current_ms; - *mon_value_was = srv_print_innodb_monitor; - *started_monitor = TRUE; - srv_print_innodb_monitor = TRUE; - os_event_set(lock_sys->timeout_event); + if (n_iterations > 20 && !buf_lru_free_blocks_error_printed) { + ib_logf(IB_LOG_LEVEL_WARN, + "Difficult to find free blocks in" + " the buffer pool (" ULINTPF " search iterations)! " + ULINTPF " failed attempts to flush a page!", + n_iterations, flush_failures); + ib_logf(IB_LOG_LEVEL_INFO, + "Consider increasing the buffer pool size."); + ib_logf(IB_LOG_LEVEL_INFO, + "Pending flushes (fsync) log: " ULINTPF + " buffer pool: " ULINTPF + " OS file reads: " ULINTPF " OS file writes: " + ULINTPF " OS fsyncs: " ULINTPF "", + fil_n_pending_log_flushes, + fil_n_pending_tablespace_flushes, + os_n_file_reads, + os_n_file_writes, + os_n_fsyncs); + + buf_lru_free_blocks_error_printed = true; } - } /** The maximum allowed backoff sleep time duration, microseconds */ @@ -1189,9 +1164,6 @@ buf_LRU_get_free_block( ibool freed = FALSE; ulint n_iterations = 0; ulint flush_failures = 0; - ibool mon_value_was = FALSE; - ibool started_monitor = FALSE; - ulint started_ms = 0; ut_ad(!mutex_own(&buf_pool->LRU_list_mutex)); @@ -1199,42 +1171,20 @@ buf_LRU_get_free_block( loop: buf_LRU_check_size_of_non_data_objects(buf_pool); - /* If there is a block in the free list, take it */ - if (DBUG_EVALUATE_IF("simulate_lack_of_pages", true, false)) { - - block = NULL; - - if (srv_debug_monitor_printed) - DBUG_SET("-d,simulate_lack_of_pages"); - - } else if (DBUG_EVALUATE_IF("simulate_recovery_lack_of_pages", - recv_recovery_on, false)) { - - block = NULL; - - if (srv_debug_monitor_printed) - DBUG_SUICIDE(); - } else { + DBUG_EXECUTE_IF("ib_lru_force_no_free_page", + if (!buf_lru_free_blocks_error_printed) { + n_iterations = 21; + goto not_found;}); - block = buf_LRU_get_free_only(buf_pool); - } + block = buf_LRU_get_free_only(buf_pool); if (block) { ut_ad(buf_pool_from_block(block) == buf_pool); memset(&block->page.zip, 0, sizeof block->page.zip); - - if (started_monitor) { - srv_print_innodb_monitor = - static_cast(mon_value_was); - } - return(block); } - if (!started_ms) - started_ms = ut_time_ms(); - if (srv_empty_free_list_algorithm == SRV_EMPTY_FREE_LIST_BACKOFF && buf_lru_manager_is_active && (srv_shutdown_state == SRV_SHUTDOWN_NONE @@ -1272,10 +1222,7 @@ buf_LRU_get_free_block( : FREE_LIST_BACKOFF_LOW_PRIO_DIVIDER)); } - buf_LRU_handle_lack_of_free_blocks(n_iterations, started_ms, - flush_failures, - &mon_value_was, - &started_monitor); + buf_LRU_handle_lack_of_free_blocks(n_iterations, flush_failures); n_iterations++; @@ -1314,13 +1261,8 @@ buf_LRU_get_free_block( mutex_exit(&buf_pool->flush_state_mutex); - if (DBUG_EVALUATE_IF("simulate_recovery_lack_of_pages", true, false) - || DBUG_EVALUATE_IF("simulate_lack_of_pages", true, false)) { - - buf_pool->try_LRU_scan = false; - } - freed = FALSE; + if (buf_pool->try_LRU_scan || n_iterations > 0) { /* If no block was in the free list, search from the @@ -1345,9 +1287,11 @@ buf_LRU_get_free_block( } - buf_LRU_handle_lack_of_free_blocks(n_iterations, started_ms, - flush_failures, &mon_value_was, - &started_monitor); +#ifndef DBUG_OFF +not_found: +#endif + + buf_LRU_handle_lack_of_free_blocks(n_iterations, flush_failures); /* If we have scanned the whole LRU and still are unable to find a free block then we should sleep here to let the @@ -2126,7 +2070,7 @@ buf_LRU_block_free_non_file_page( ut_d(block->page.in_free_list = TRUE); mutex_exit(&buf_pool->free_list_mutex); - UNIV_MEM_ASSERT_AND_FREE(block->frame, UNIV_PAGE_SIZE); + UNIV_MEM_FREE(block->frame, UNIV_PAGE_SIZE); } /******************************************************************//** diff --git a/storage/xtradb/buf/buf0rea.cc b/storage/xtradb/buf/buf0rea.cc index 76b715507100a648ad5792e2d408fd0f0f0cc778..43e678ed7d492a1336ac273a01134c36231ec272 100644 --- a/storage/xtradb/buf/buf0rea.cc +++ b/storage/xtradb/buf/buf0rea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -124,7 +124,12 @@ not exist or is being dropped use to stop dangling page reads from a tablespace which we have DISCARDed + IMPORTed back @param[in] offset page number -@param[in] trx transaction +@param[in,out] trx transaction +@param[in] should_buffer whether to buffer an aio request. + AIO read ahead uses this. If you plan to + use this parameter, make sure you remember + to call os_aio_dispatch_read_array_submit() + when you're ready to commit all your requests @return 1 if read request is issued. 0 if it is not */ static ulint @@ -137,7 +142,8 @@ buf_read_page_low( ibool unzip, ib_int64_t tablespace_version, ulint offset, - trx_t* trx = NULL) + trx_t* trx = NULL, + bool should_buffer = false) { buf_page_t* bpage; ulint wake_later; @@ -240,17 +246,18 @@ buf_read_page_low( } if (zip_size) { - *err = _fil_io(OS_FILE_READ | wake_later - | ignore_nonexistent_pages, - sync, space, zip_size, offset, 0, zip_size, - frame, bpage, 0, trx); + *err = fil_io(OS_FILE_READ | wake_later + | ignore_nonexistent_pages, + sync, space, zip_size, offset, 0, zip_size, + frame, bpage, 0, trx, should_buffer); } else { ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE); - *err = _fil_io(OS_FILE_READ | wake_later + *err = fil_io(OS_FILE_READ | wake_later | ignore_nonexistent_pages, sync, space, 0, offset, 0, UNIV_PAGE_SIZE, - frame, bpage, &bpage->write_size, trx); + frame, bpage, &bpage->write_size, + trx, should_buffer); } if (sync) { @@ -848,7 +855,7 @@ buf_read_ahead_linear( &err, false, ibuf_mode, space, zip_size, FALSE, tablespace_version, - i, trx); + i, trx, true); switch(err) { case DB_SUCCESS: @@ -876,6 +883,7 @@ buf_read_ahead_linear( } } } + os_aio_dispatch_read_array_submit(); /* In simulated aio we wake the aio handler threads only after queuing all aio requests, in native aio the following call does @@ -952,7 +960,7 @@ buf_read_ibuf_merge_pages( buf_read_page_low(&err, sync && (i + 1 == n_stored), BUF_READ_ANY_PAGE, space_ids[i], zip_size, TRUE, space_versions[i], - page_nos[i], NULL); + page_nos[i]); switch(err) { case DB_SUCCESS: @@ -1100,13 +1108,12 @@ buf_read_recv_pages( if ((i + 1 == n_stored) && sync) { buf_read_page_low(&err, true, BUF_READ_ANY_PAGE, space, zip_size, TRUE, tablespace_version, - page_nos[i], NULL); + page_nos[i]); } else { buf_read_page_low(&err, false, BUF_READ_ANY_PAGE | OS_AIO_SIMULATED_WAKE_LATER, space, zip_size, TRUE, - tablespace_version, page_nos[i], - NULL); + tablespace_version, page_nos[i]); } if (err == DB_DECRYPTION_FAILED) { diff --git a/storage/xtradb/data/data0type.cc b/storage/xtradb/data/data0type.cc index 0b9e08544a5c4d33b4ddcde4049b68838db86f6c..34ca399f9b2ad99583f22b7a2c8f6b7cadd0c0cc 100644 --- a/storage/xtradb/data/data0type.cc +++ b/storage/xtradb/data/data0type.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -49,8 +50,10 @@ ulint dtype_get_at_most_n_mbchars( /*========================*/ ulint prtype, /*!< in: precise type */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multi-byte character */ + ulint mbminlen, /*!< in: minimum length of + a multi-byte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of + a multi-byte character, in bytes */ ulint prefix_len, /*!< in: length of the requested prefix, in characters, multiplied by dtype_get_mbmaxlen(dtype) */ @@ -58,9 +61,6 @@ dtype_get_at_most_n_mbchars( const char* str) /*!< in: the string whose prefix length is being determined */ { - ulint mbminlen = DATA_MBMINLEN(mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(mbminmaxlen); - ut_a(data_len != UNIV_SQL_NULL); ut_ad(!mbmaxlen || !(prefix_len % mbmaxlen)); diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc index 5af3a635a96f47fe3b9316b1262f5baf7fc2727e..9257321c7eff14f6eb69aefcbf9daee16fb8ea2a 100644 --- a/storage/xtradb/dict/dict0dict.cc +++ b/storage/xtradb/dict/dict0dict.cc @@ -3409,6 +3409,7 @@ dict_foreign_find_index( if (types_idx != index && !(index->type & DICT_FTS) && !index->to_be_dropped + && !dict_index_is_online_ddl(index) && dict_foreign_qualify_index( table, col_names, columns, n_cols, index, types_idx, diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc index 125d7d78a1f3dc69d9e66414dc6b0b9d1963099e..cf27caf6c28f00bca646b746592073f9dc42531c 100644 --- a/storage/xtradb/dict/dict0mem.cc +++ b/storage/xtradb/dict/dict0mem.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -533,7 +533,8 @@ dict_mem_fill_column_struct( column->len = (unsigned int) col_len; #ifndef UNIV_HOTBACKUP dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen); - dict_col_set_mbminmaxlen(column, mbminlen, mbmaxlen); + column->mbminlen = mbminlen; + column->mbmaxlen = mbmaxlen; #endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/xtradb/dict/dict0stats_bg.cc b/storage/xtradb/dict/dict0stats_bg.cc index e166e7df72a1da7c39777a2ab89baabe300295de..884f62103f501cf941b5d83908a78d7d815e4392 100644 --- a/storage/xtradb/dict/dict0stats_bg.cc +++ b/storage/xtradb/dict/dict0stats_bg.cc @@ -337,7 +337,7 @@ dict_stats_wait_bg_to_stop_using_table( unlocking/locking the data dict */ { while (!dict_stats_stop_bg(table)) { - DICT_STATS_BG_YIELD(trx); + DICT_BG_YIELD(trx); } } diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 9023b4446b584179c8e4a9ee7cde452202cb5241..96902cd77ec15dc7c024ecf9b206a628cf069c4f 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, 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 @@ -2125,7 +2125,7 @@ fil_write_flushed_lsn( { byte* buf1; byte* buf; - dberr_t err; + dberr_t err = DB_TABLESPACE_NOT_FOUND; buf1 = static_cast(ut_malloc(2 * UNIV_PAGE_SIZE)); buf = static_cast(ut_align(buf1, UNIV_PAGE_SIZE)); @@ -4967,6 +4967,11 @@ fil_load_single_table_tablespace( return; } + /* In mariabackup lets not crash. */ + if (IS_XTRABACKUP()) { + return; + } + abort(); } @@ -6056,7 +6061,7 @@ Reads or writes data. This operation is asynchronous (aio). i/o on a tablespace which does not exist */ UNIV_INTERN dberr_t -_fil_io( +fil_io( /*===*/ ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE, ORed to OS_FILE_LOG, if a log i/o @@ -6088,7 +6093,12 @@ _fil_io( operation for this page and if initialized we do not trim again if actual page size does not decrease. */ - trx_t* trx) + trx_t* trx, + bool should_buffer) /*!< in: whether to buffer an aio request. + AIO read ahead uses this. If you plan to + use this parameter, make sure you remember + to call os_aio_dispatch_read_array_submit() + when you're ready to commit all your requests.*/ { ulint mode; fil_space_t* space; @@ -6308,8 +6318,8 @@ _fil_io( /* Queue the aio request */ ret = os_aio(type, is_log, mode | wake_later, name, node->handle, buf, - offset, len, zip_size ? zip_size : UNIV_PAGE_SIZE, node, - message, space_id, trx, write_size); + offset, len, zip_size ? zip_size : UNIV_PAGE_SIZE, node, + message, space_id, trx, write_size, should_buffer); #else /* In mysqlbackup do normal i/o, not aio */ diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc index 88b5ad97277298ce7688a02fc89e3a5b6fe5e04e..98aaf610f2a9a9d4ef6228c7944435df6258d468 100644 --- a/storage/xtradb/fts/fts0fts.cc +++ b/storage/xtradb/fts/fts0fts.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2016, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -26,6 +26,7 @@ Full Text Search interface #include "row0mysql.h" #include "row0upd.h" #include "dict0types.h" +#include "dict0stats_bg.h" #include "row0sel.h" #include "fts0fts.h" @@ -868,18 +869,37 @@ fts_drop_index( err = fts_drop_index_tables(trx, index); - fts_free(table); - + for(;;) { + bool retry = false; + if (index->index_fts_syncing) { + retry = true; + } + if (!retry){ + fts_free(table); + break; + } + DICT_BG_YIELD(trx); + } return(err); } - current_doc_id = table->fts->cache->next_doc_id; - first_doc_id = table->fts->cache->first_doc_id; - fts_cache_clear(table->fts->cache); - fts_cache_destroy(table->fts->cache); - table->fts->cache = fts_cache_create(table); - table->fts->cache->next_doc_id = current_doc_id; - table->fts->cache->first_doc_id = first_doc_id; + for(;;) { + bool retry = false; + if (index->index_fts_syncing) { + retry = true; + } + if (!retry){ + current_doc_id = table->fts->cache->next_doc_id; + first_doc_id = table->fts->cache->first_doc_id; + fts_cache_clear(table->fts->cache); + fts_cache_destroy(table->fts->cache); + table->fts->cache = fts_cache_create(table); + table->fts->cache->next_doc_id = current_doc_id; + table->fts->cache->first_doc_id = first_doc_id; + break; + } + DICT_BG_YIELD(trx); + } } else { fts_cache_t* cache = table->fts->cache; fts_index_cache_t* index_cache; @@ -889,9 +909,17 @@ fts_drop_index( index_cache = fts_find_index_cache(cache, index); if (index_cache != NULL) { - if (index_cache->words) { - fts_words_free(index_cache->words); - rbt_free(index_cache->words); + for(;;) { + bool retry = false; + if (index->index_fts_syncing) { + retry = true; + } + if (!retry && index_cache->words) { + fts_words_free(index_cache->words); + rbt_free(index_cache->words); + break; + } + DICT_BG_YIELD(trx); } ib_vector_remove(cache->indexes, *(void**) index_cache); @@ -1973,7 +2001,7 @@ fts_create_one_index_table( ? DATA_VARCHAR : DATA_VARMYSQL, field->col->prtype, FTS_MAX_WORD_LEN_IN_CHAR - * DATA_MBMAXLEN(field->col->mbminmaxlen)); + * field->col->mbmaxlen); dict_mem_table_add_col(new_table, heap, "first_doc_id", DATA_INT, DATA_NOT_NULL | DATA_UNSIGNED, @@ -3333,8 +3361,7 @@ fts_fetch_doc_from_rec( dict_table_zip_size(table), clust_pos, &doc->text.f_len, static_cast( - doc->self_heap->arg), - NULL); + doc->self_heap->arg)); } else { doc->text.f_str = (byte*) rec_get_nth_field( clust_rec, offsets, clust_pos, @@ -4568,10 +4595,16 @@ fts_sync( index_cache = static_cast( ib_vector_get(cache->indexes, i)); - if (index_cache->index->to_be_dropped) { + if (index_cache->index->to_be_dropped + || index_cache->index->table->to_be_dropped) { continue; } + index_cache->index->index_fts_syncing = true; + DBUG_EXECUTE_IF("fts_instrument_sync_sleep_drop_waits", + os_thread_sleep(10000000); + ); + error = fts_sync_index(sync, index_cache); if (error != DB_SUCCESS && !sync->interrupted) { @@ -4604,11 +4637,33 @@ fts_sync( end_sync: if (error == DB_SUCCESS && !sync->interrupted) { error = fts_sync_commit(sync); + if (error == DB_SUCCESS) { + for (i = 0; i < ib_vector_size(cache->indexes); ++i) { + fts_index_cache_t* index_cache; + index_cache = static_cast( + ib_vector_get(cache->indexes, i)); + if (index_cache->index->index_fts_syncing) { + index_cache->index->index_fts_syncing + = false; + } + } + } } else { fts_sync_rollback(sync); } rw_lock_x_lock(&cache->lock); + /* Clear fts syncing flags of any indexes incase sync is + interrupeted */ + for (i = 0; i < ib_vector_size(cache->indexes); ++i) { + fts_index_cache_t* index_cache; + index_cache = static_cast( + ib_vector_get(cache->indexes, i)); + if (index_cache->index->index_fts_syncing == true) { + index_cache->index->index_fts_syncing = false; + } + } + sync->interrupted = false; sync->in_progress = false; os_event_set(sync->event); @@ -7535,8 +7590,7 @@ fts_init_recover_doc( &doc.text.f_len, static_cast(dfield_get_data(dfield)), zip_size, len, - static_cast(doc.self_heap->arg), - NULL); + static_cast(doc.self_heap->arg)); } else { doc.text.f_str = static_cast( dfield_get_data(dfield)); diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc index cb30122adcb555b6bcdf9c9d07c1d0dc124c3da1..d9f969480003b1fcd0a66b1c13e64779c9653ab8 100644 --- a/storage/xtradb/fts/fts0opt.cc +++ b/storage/xtradb/fts/fts0opt.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2016, MariaDB Corporation. All Rights reserved. This program is free software; you can redistribute it and/or modify it under @@ -2971,13 +2971,6 @@ fts_optimize_sync_table( { dict_table_t* table = NULL; - /* Prevent DROP INDEX etc. from running when we are syncing - cache in background. */ - if (!rw_lock_s_lock_nowait(&dict_operation_lock, __FILE__, __LINE__)) { - /* Exit when fail to get dict operation lock. */ - return; - } - table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL); if (table) { @@ -2987,8 +2980,6 @@ fts_optimize_sync_table( dict_table_close(table, FALSE, FALSE); } - - rw_lock_s_unlock(&dict_operation_lock); } /**********************************************************************//** diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc index 358d979fff60b2cbec865174fd26c9e7266cdc89..0b0aecaeaa2cb70d3ade3b21cc77a77e8f08807b 100644 --- a/storage/xtradb/fts/fts0que.cc +++ b/storage/xtradb/fts/fts0que.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -1937,8 +1937,7 @@ fts_query_fetch_document( if (dfield_is_ext(dfield)) { data = btr_copy_externally_stored_field( &cur_len, data, phrase->zip_size, - dfield_get_len(dfield), phrase->heap, - NULL); + dfield_get_len(dfield), phrase->heap); } else { cur_len = dfield_get_len(dfield); } @@ -3656,6 +3655,7 @@ fts_query_free( if (query->intersection) { fts_query_free_doc_ids(query, query->intersection); + query->intersection = NULL; } if (query->doc_ids) { diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 37755cb9078fbce630baa505affad2c673f728bd..65ac41c26de374c8b239dfec94f67a0d6696a5c3 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -1289,6 +1289,8 @@ static SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_sec_rec_cluster_reads, SHOW_LONG}, {"secondary_index_triggered_cluster_reads_avoided", (char*) &export_vars.innodb_sec_rec_cluster_reads_avoided, SHOW_LONG}, + {"buffered_aio_submitted", + (char*) &export_vars.innodb_buffered_aio_submitted, SHOW_LONG}, /* Encryption */ {"encryption_rotation_pages_read_from_cache", @@ -12321,6 +12323,7 @@ innobase_table_flags( case ROW_TYPE_DEFAULT: /* If we fell through, set row format to Compact. */ row_format = ROW_TYPE_COMPACT; + /* fall through */ case ROW_TYPE_COMPACT: break; } @@ -13710,7 +13713,7 @@ ha_innobase::records_in_range( n_rows = btr_estimate_n_rows_in_range(index, range_start, mode1, range_end, - mode2, prebuilt->trx); + mode2); } else { n_rows = HA_POS_ERROR; @@ -21081,6 +21084,13 @@ static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks, "Print all deadlocks to MySQL error log (off by default)", NULL, NULL, FALSE); +static MYSQL_SYSVAR_BOOL( + print_lock_wait_timeout_info, + srv_print_lock_wait_timeout_info, + PLUGIN_VAR_OPCMDARG, + "Print lock wait timeout info to MySQL error log (off by default)", + NULL, NULL, FALSE); + static MYSQL_SYSVAR_ULONG(compression_failure_threshold_pct, zip_failure_threshold_pct, PLUGIN_VAR_OPCMDARG, "If the compression failure rate of a table is greater than this number" @@ -21539,6 +21549,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(foreground_preflush), MYSQL_SYSVAR(empty_free_list_algorithm), MYSQL_SYSVAR(print_all_deadlocks), + MYSQL_SYSVAR(print_lock_wait_timeout_info), MYSQL_SYSVAR(cmp_per_index_enabled), MYSQL_SYSVAR(undo_logs), MYSQL_SYSVAR(rollback_segments), diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index b2f0d301815c39777e0c4517df87636916d4e220..2a2c466fd4f627361ae751d8aebf8c4005ab58a3 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2018, MariaDB Corporation. 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 as published by the Free Software @@ -1200,8 +1200,7 @@ innobase_col_to_mysql( #ifdef UNIV_DEBUG case DATA_MYSQL: ut_ad(flen >= len); - ut_ad(DATA_MBMAXLEN(col->mbminmaxlen) - >= DATA_MBMINLEN(col->mbminmaxlen)); + ut_ad(col->mbmaxlen >= col->mbminlen); memcpy(dest, data, len); break; @@ -5917,7 +5916,47 @@ ha_innobase::commit_inplace_alter_table( break; } - DICT_STATS_BG_YIELD(trx); + DICT_BG_YIELD(trx); + } + + /* Make a concurrent Drop fts Index to wait until sync of that + fts index is happening in the background */ + for (;;) { + bool retry = false; + + for (inplace_alter_handler_ctx** pctx = ctx_array; + *pctx; pctx++) { + int count =0; + ha_innobase_inplace_ctx* ctx + = static_cast(*pctx); + DBUG_ASSERT(new_clustered == ctx->need_rebuild()); + + if (dict_fts_index_syncing(ctx->old_table)) { + count++; + if (count == 100) { + fprintf(stderr, + "Drop index waiting for background sync" + "to finish\n"); + } + retry = true; + } + + if (new_clustered && dict_fts_index_syncing(ctx->new_table)) { + count++; + if (count == 100) { + fprintf(stderr, + "Drop index waiting for background sync" + "to finish\n"); + } + retry = true; + } + } + + if (!retry) { + break; + } + + DICT_BG_YIELD(trx); } /* Apply the changes to the data dictionary tables, for all @@ -6233,8 +6272,13 @@ ha_innobase::commit_inplace_alter_table( ut_d(dict_table_check_for_dup_indexes( ctx->new_table, CHECK_ABORTED_OK)); - ut_a(fts_check_cached_index(ctx->new_table)); +#ifdef UNIV_DEBUG + if (!(ctx->new_table->fts != NULL + && ctx->new_table->fts->cache->sync->in_progress)) { + ut_a(fts_check_cached_index(ctx->new_table)); + } +#endif if (new_clustered) { /* Since the table has been rebuilt, we remove all persistent statistics corresponding to the diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index 6925cd3abb5ed66999902ae1c5577a8f74de8ff2..b169916c34eb5f9c480b88d1360303f7799095f8 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2018, 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 @@ -4645,7 +4645,7 @@ ibuf_merge_or_delete_for_page( function. When the counter is > 0, that prevents tablespace from being dropped. */ - space = fil_space_acquire(space_id); + space = fil_space_acquire_silent(space_id); if (UNIV_UNLIKELY(!space)) { /* Do not try to read the bitmap page from space; diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h index e478b33bf8efe196054792ad009ef2ecae2bcd1c..1b0632e21205182cf0da9786859ff1c7b74f417b 100644 --- a/storage/xtradb/include/btr0cur.h +++ b/storage/xtradb/include/btr0cur.h @@ -568,8 +568,7 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */ ulint mode1, /*!< in: search mode for range start */ const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */ - ulint mode2, /*!< in: search mode for range end */ - trx_t* trx); /*!< in: trx */ + ulint mode2); /*!< in: search mode for range end */ /*******************************************************************//** Estimates the number of different key values in a given index, for each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index). @@ -704,8 +703,7 @@ btr_copy_externally_stored_field_prefix( field containing also the reference to the external part; must be protected by a lock or a page latch */ - ulint local_len,/*!< in: length of data, in bytes */ - trx_t* trx); /*!< in: transaction handle */ + ulint local_len);/*!< in: length of data, in bytes */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. The clustered index record must be protected by a lock or a page latch. @@ -722,8 +720,7 @@ btr_copy_externally_stored_field( ulint zip_size,/*!< in: nonzero=compressed BLOB page size, zero for uncompressed BLOBs */ ulint local_len,/*!< in: length of data */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx); /*!< in: transaction handle */ + mem_heap_t* heap); /*!< in: mem heap */ /*******************************************************************//** Copies an externally stored field of a record to mem heap. @return the field copied to heap, or NULL if the field is incomplete */ @@ -738,8 +735,7 @@ btr_rec_copy_externally_stored_field( zero for uncompressed BLOBs */ ulint no, /*!< in: field number */ ulint* len, /*!< out: length of the field */ - mem_heap_t* heap, /*!< in: mem heap */ - trx_t* trx); /*!< in: transaction handle */ + mem_heap_t* heap); /*!< in: mem heap */ /*******************************************************************//** Flags the data tuple fields that are marked as extern storage in the update vector. We use this function to remember which fields we must diff --git a/storage/xtradb/include/data0type.h b/storage/xtradb/include/data0type.h index df6b6a41c1184e85ed1bddf9483c049a51c291ad..f3ecab5a3ba443f61915284534e6cebf2b6819fa 100644 --- a/storage/xtradb/include/data0type.h +++ b/storage/xtradb/include/data0type.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -182,18 +182,7 @@ store the charset-collation number; one byte is left unused, though */ #define DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE 6 /* Maximum multi-byte character length in bytes, plus 1 */ -#define DATA_MBMAX 5 - -/* Pack mbminlen, mbmaxlen to mbminmaxlen. */ -#define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \ - ((mbmaxlen) * DATA_MBMAX + (mbminlen)) -/* Get mbminlen from mbminmaxlen. Cast the result of UNIV_EXPECT to ulint -because in GCC it returns a long. */ -#define DATA_MBMINLEN(mbminmaxlen) ((ulint) \ - UNIV_EXPECT(((mbminmaxlen) % DATA_MBMAX), \ - 1)) -/* Get mbmaxlen from mbminmaxlen. */ -#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX)) +#define DATA_MBMAX 8 /* We now support 15 bits (up to 32767) collation number */ #define MAX_CHAR_COLL_NUM 32767 @@ -220,8 +209,10 @@ ulint dtype_get_at_most_n_mbchars( /*========================*/ ulint prtype, /*!< in: precise type */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multi-byte character */ + ulint mbminlen, /*!< in: minimum length of + a multi-byte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of + a multi-byte character, in bytes */ ulint prefix_len, /*!< in: length of the requested prefix, in characters, multiplied by dtype_get_mbmaxlen(dtype) */ @@ -366,19 +357,6 @@ dtype_get_mbmaxlen( /*===============*/ const dtype_t* type); /*!< in: type */ /*********************************************************************//** -Sets the minimum and maximum length of a character, in bytes. */ -UNIV_INLINE -void -dtype_set_mbminmaxlen( -/*==================*/ - dtype_t* type, /*!< in/out: type */ - ulint mbminlen, /*!< in: minimum length of a char, - in bytes, or 0 if this is not - a character type */ - ulint mbmaxlen); /*!< in: maximum length of a char, - in bytes, or 0 if this is not - a character type */ -/*********************************************************************//** Gets the padding character code for the type. @return padding character code, or ULINT_UNDEFINED if no padding specified */ UNIV_INLINE @@ -398,7 +376,9 @@ dtype_get_fixed_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of a + ulint mbminlen, /*!< in: minimum length of a + multibyte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of a multibyte character, in bytes */ ulint comp); /*!< in: nonzero=ROW_FORMAT=COMPACT */ #ifndef UNIV_HOTBACKUP @@ -412,8 +392,8 @@ dtype_get_min_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen); /*!< in: minimum and maximum length of a - multibyte character */ + ulint mbminlen, /*!< in: minimum length of a character */ + ulint mbmaxlen); /*!< in: maximum length of a character */ /***********************************************************************//** Returns the maximum size of a data type. Note: types in system tables may be incomplete and return incorrect information. @@ -530,11 +510,10 @@ struct dtype_t{ the string, MySQL uses 1 or 2 bytes to store the string length) */ #ifndef UNIV_HOTBACKUP - unsigned mbminmaxlen:5; /*!< minimum and maximum length of a - character, in bytes; - DATA_MBMINMAXLEN(mbminlen,mbmaxlen); - mbminlen=DATA_MBMINLEN(mbminmaxlen); - mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ + unsigned mbminlen:3; /*!< minimum length of a character, + in bytes */ + unsigned mbmaxlen:3; /*!< maximum length of a character, + in bytes */ #endif /* !UNIV_HOTBACKUP */ }; diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic index ff72f6ed20fceb1c61ca9f075072616f60a413c0..96b001e197eab156978a0bc160945463a8e32e69 100644 --- a/storage/xtradb/include/data0type.ic +++ b/storage/xtradb/include/data0type.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -104,27 +104,6 @@ dtype_get_mblen( } } -/*********************************************************************//** -Sets the minimum and maximum length of a character, in bytes. */ -UNIV_INLINE -void -dtype_set_mbminmaxlen( -/*==================*/ - dtype_t* type, /*!< in/out: type */ - ulint mbminlen, /*!< in: minimum length of a char, - in bytes, or 0 if this is not - a character type */ - ulint mbmaxlen) /*!< in: maximum length of a char, - in bytes, or 0 if this is not - a character type */ -{ - ut_ad(mbminlen < DATA_MBMAX); - ut_ad(mbmaxlen < DATA_MBMAX); - ut_ad(mbminlen <= mbmaxlen); - - type->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen); -} - /*********************************************************************//** Compute the mbminlen and mbmaxlen members of a data type structure. */ UNIV_INLINE @@ -137,7 +116,8 @@ dtype_set_mblen( ulint mbmaxlen; dtype_get_mblen(type->mtype, type->prtype, &mbminlen, &mbmaxlen); - dtype_set_mbminmaxlen(type, mbminlen, mbmaxlen); + type->mbminlen = mbminlen; + type->mbmaxlen = mbmaxlen; ut_ad(dtype_validate(type)); } @@ -233,8 +213,7 @@ dtype_get_mbminlen( /*===============*/ const dtype_t* type) /*!< in: type */ { - ut_ad(type); - return(DATA_MBMINLEN(type->mbminmaxlen)); + return type->mbminlen; } /*********************************************************************//** Gets the maximum length of a character, in bytes. @@ -246,8 +225,7 @@ dtype_get_mbmaxlen( /*===============*/ const dtype_t* type) /*!< in: type */ { - ut_ad(type); - return(DATA_MBMAXLEN(type->mbminmaxlen)); + return type->mbmaxlen; } /*********************************************************************//** @@ -523,8 +501,10 @@ dtype_get_fixed_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multibyte character, in bytes */ + ulint mbminlen, /*!< in: minimum length of a + multibyte character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of a + multibyte character, in bytes */ ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ { switch (mtype) { @@ -565,11 +545,10 @@ dtype_get_fixed_size_low( dtype_get_charset_coll(prtype), &i_mbminlen, &i_mbmaxlen); - ut_ad(DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen) - == mbminmaxlen); + ut_ad(i_mbminlen == mbminlen); + ut_ad(i_mbmaxlen == mbmaxlen); #endif /* UNIV_DEBUG */ - if (DATA_MBMINLEN(mbminmaxlen) - == DATA_MBMAXLEN(mbminmaxlen)) { + if (mbminlen == mbmaxlen) { return(len); } } @@ -602,8 +581,8 @@ dtype_get_min_size_low( ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ ulint len, /*!< in: length */ - ulint mbminmaxlen) /*!< in: minimum and maximum length of a - multi-byte character */ + ulint mbminlen, /*!< in: minimum length of a character */ + ulint mbmaxlen) /*!< in: maximum length of a character */ { switch (mtype) { case DATA_SYS: @@ -633,9 +612,6 @@ dtype_get_min_size_low( if (prtype & DATA_BINARY_TYPE) { return(len); } else { - ulint mbminlen = DATA_MBMINLEN(mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(mbminmaxlen); - if (mbminlen == mbmaxlen) { return(len); } @@ -706,9 +682,9 @@ dtype_get_sql_null_size( { #ifndef UNIV_HOTBACKUP return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, - type->mbminmaxlen, comp)); + type->mbminlen, type->mbmaxlen, comp)); #else /* !UNIV_HOTBACKUP */ return(dtype_get_fixed_size_low(type->mtype, type->prtype, type->len, - 0, 0)); + 0, 0, 0)); #endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index dda8f4d271416c73efadf684dbb9dc68892664b3..241ed89e36bf9c85c114f4ce1b805dba142c6c9c 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -197,18 +197,6 @@ dict_col_get_mbmaxlen( const dict_col_t* col) /*!< in: column */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** -Sets the minimum and maximum number of bytes per character. */ -UNIV_INLINE -void -dict_col_set_mbminmaxlen( -/*=====================*/ - dict_col_t* col, /*!< in/out: column */ - ulint mbminlen, /*!< in: minimum multi-byte - character size, in bytes */ - ulint mbmaxlen) /*!< in: minimum multi-byte - character size, in bytes */ - MY_ATTRIBUTE((nonnull)); -/*********************************************************************//** Gets the column data type. */ UNIV_INLINE void diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic index 4db6a73bbc2159fab82a51816f4c9678c771c01e..17b4adc10e29c9717f4999f8bedd0c10ba2d55a5 100644 --- a/storage/xtradb/include/dict0dict.ic +++ b/storage/xtradb/include/dict0dict.ic @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2018, 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 @@ -41,7 +41,7 @@ dict_col_get_mbminlen( /*==================*/ const dict_col_t* col) /*!< in: column */ { - return(DATA_MBMINLEN(col->mbminmaxlen)); + return col->mbminlen; } /*********************************************************************//** Gets the maximum number of bytes per character. @@ -52,25 +52,7 @@ dict_col_get_mbmaxlen( /*==================*/ const dict_col_t* col) /*!< in: column */ { - return(DATA_MBMAXLEN(col->mbminmaxlen)); -} -/*********************************************************************//** -Sets the minimum and maximum number of bytes per character. */ -UNIV_INLINE -void -dict_col_set_mbminmaxlen( -/*=====================*/ - dict_col_t* col, /*!< in/out: column */ - ulint mbminlen, /*!< in: minimum multi-byte - character size, in bytes */ - ulint mbmaxlen) /*!< in: minimum multi-byte - character size, in bytes */ -{ - ut_ad(mbminlen < DATA_MBMAX); - ut_ad(mbmaxlen < DATA_MBMAX); - ut_ad(mbminlen <= mbmaxlen); - - col->mbminmaxlen = DATA_MBMINMAXLEN(mbminlen, mbmaxlen); + return col->mbmaxlen; } /*********************************************************************//** Gets the column data type. */ @@ -87,7 +69,8 @@ dict_col_copy_type( type->mtype = col->mtype; type->prtype = col->prtype; type->len = col->len; - type->mbminmaxlen = col->mbminmaxlen; + type->mbminlen = col->mbminlen; + type->mbmaxlen = col->mbmaxlen; } #endif /* !UNIV_HOTBACKUP */ @@ -109,7 +92,8 @@ dict_col_type_assert_equal( ut_ad(col->prtype == type->prtype); //ut_ad(col->len == type->len); # ifndef UNIV_HOTBACKUP - ut_ad(col->mbminmaxlen == type->mbminmaxlen); + ut_ad(col->mbminlen == type->mbminlen); + ut_ad(col->mbmaxlen == type->mbmaxlen); # endif /* !UNIV_HOTBACKUP */ return(TRUE); @@ -127,7 +111,7 @@ dict_col_get_min_size( const dict_col_t* col) /*!< in: column */ { return(dtype_get_min_size_low(col->mtype, col->prtype, col->len, - col->mbminmaxlen)); + col->mbminlen, col->mbmaxlen)); } /***********************************************************************//** Returns the maximum size of the column. @@ -152,7 +136,7 @@ dict_col_get_fixed_size( ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ { return(dtype_get_fixed_size_low(col->mtype, col->prtype, col->len, - col->mbminmaxlen, comp)); + col->mbminlen, col->mbmaxlen, comp)); } /***********************************************************************//** Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. @@ -1076,6 +1060,27 @@ dict_table_x_lock_indexes( } } +/*********************************************************************//** +Returns true if the particular FTS index in the table is still syncing +in the background, false otherwise. +@param [in] table Table containing FTS index +@return True if sync of fts index is still going in the background */ +UNIV_INLINE +bool +dict_fts_index_syncing( + dict_table_t* table) +{ + dict_index_t* index; + + for (index = dict_table_get_first_index(table); + index != NULL; + index = dict_table_get_next_index(index)) { + if (index->index_fts_syncing) { + return(true); + } + } + return(false); +} /*********************************************************************//** Release the exclusive locks on all index tree. */ UNIV_INLINE diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index 2a4422fc18bc5525c0d1d38ac7d91e6963ebb079..bdec503c88ccfd3c7e42739672281244baa6f7b0 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -1,8 +1,8 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -538,11 +538,10 @@ struct dict_col_t{ the string, MySQL uses 1 or 2 bytes to store the string length) */ - unsigned mbminmaxlen:5; /*!< minimum and maximum length of a - character, in bytes; - DATA_MBMINMAXLEN(mbminlen,mbmaxlen); - mbminlen=DATA_MBMINLEN(mbminmaxlen); - mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */ + unsigned mbminlen:3; /*!< minimum length of a + character, in bytes */ + unsigned mbmaxlen:3; /*!< maximum length of a + character, in bytes */ /*----------------------*/ /* End of definitions copied from dtype_t */ /* @} */ @@ -720,6 +719,8 @@ struct dict_index_t{ dict_sys->mutex. Other changes are protected by index->lock. */ dict_field_t* fields; /*!< array of field descriptions */ + bool index_fts_syncing;/*!< Whether the fts index is + still syncing in the background */ #ifndef UNIV_HOTBACKUP UT_LIST_NODE_T(dict_index_t) indexes;/*!< list of indexes of the table */ diff --git a/storage/xtradb/include/dict0stats_bg.h b/storage/xtradb/include/dict0stats_bg.h index 8f3385eb22b6a1365da013e942c0cf34ae76247b..66fcf7a09982e46221c13cc64fdc6ddfd61c53f1 100644 --- a/storage/xtradb/include/dict0stats_bg.h +++ b/storage/xtradb/include/dict0stats_bg.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -83,7 +83,7 @@ dict_stats_defrag_pool_del( /** Yield the data dictionary latch when waiting for the background thread to stop accessing a table. @param trx transaction holding the data dictionary locks */ -#define DICT_STATS_BG_YIELD(trx) do { \ +#define DICT_BG_YIELD(trx) do { \ row_mysql_unlock_data_dictionary(trx); \ os_thread_sleep(250000); \ row_mysql_lock_data_dictionary(trx); \ diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 5fe2d20b4f052c61aa333860c4860675f87c8efb..8c3bf7d2b062bf7b9eac27d6b70f8a39f6ff281c 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -1161,7 +1161,7 @@ Reads or writes data. This operation is asynchronous (aio). i/o on a tablespace which does not exist */ UNIV_INTERN dberr_t -_fil_io( +fil_io( /*===*/ ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE, ORed to OS_FILE_LOG, if a log i/o @@ -1189,16 +1189,18 @@ _fil_io( void* message, /*!< in: message for aio handler if non-sync aio used, else ignored */ ulint* write_size, /*!< in/out: Actual write size initialized - after fist successfull trim - operation for this page and if - initialized we do not trim again if - actual page size does not decrease. */ - trx_t* trx) /*!< in: trx */ - - __attribute__((nonnull(8))); - -#define fil_io(type, sync, space_id, zip_size, block_offset, byte_offset, len, buf, message, write_size) \ - _fil_io(type, sync, space_id, zip_size, block_offset, byte_offset, len, buf, message, write_size, NULL) + after fist successfull trim + operation for this page and if + initialized we do not trim again if + actual page size does not decrease. */ + trx_t* trx = NULL, /*!< in: trx */ + bool should_buffer = false) + /*!< in: whether to buffer an aio request. + AIO read ahead uses this. If you plan to + use this parameter, make sure you remember + to call os_aio_dispatch_read_array_submit() + when you're ready to commit all your requests.*/ + MY_ATTRIBUTE((nonnull(8))); /** Determine the block size of the data file. @param[in] space tablespace diff --git a/storage/xtradb/include/log0crypt.h b/storage/xtradb/include/log0crypt.h index 0ad7e7d7037a92cf08c6295c55aa9d8cd35aa4a5..b7a221e0a8172892a13bd349d5f1d1067b5da1ce 100644 --- a/storage/xtradb/include/log0crypt.h +++ b/storage/xtradb/include/log0crypt.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2018, 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 @@ -73,6 +73,8 @@ log_encrypt_before_write( /*=====================*/ ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */ byte* block, /*!< in/out: pointer to a log block */ + lsn_t lsn, /*!< in: log sequence number of + the start of the buffer */ const ulint size); /*!< in: size of log blocks */ /******************************************************** @@ -83,6 +85,8 @@ void log_decrypt_after_read( /*===================*/ byte* frame, /*!< in/out: log segment */ + lsn_t lsn, /*!< in: log sequence number of the start + of the buffer */ const ulint size); /*!< in: log segment size */ /* Error codes for crypt info */ diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h index 5c3e7d07fd91241964b5c0aa3dbb1df2b22175d6..2d1febe9b9fc81b8bc9430c45d78dc699b20594b 100644 --- a/storage/xtradb/include/log0online.h +++ b/storage/xtradb/include/log0online.h @@ -129,7 +129,11 @@ log_online_bitmap_iterator_next( /** Struct for single bitmap file information */ struct log_online_bitmap_file_struct { - char name[FN_REFLEN]; /*!< Name with full path */ + /** Name with full path + 61 is a nice magic constant for the extra space needed for the sprintf + template in the cc file + */ + char name[FN_REFLEN+61]; /*!< Name with full path */ pfs_os_file_t file; /*!< Handle to opened file */ ib_uint64_t size; /*!< Size of the file */ os_offset_t offset; /*!< Offset of the next read, diff --git a/storage/xtradb/include/mem0mem.ic b/storage/xtradb/include/mem0mem.ic index 63e68150b61da7235e2cf95099563e442343a247..2b4638718fd11770488d4ecb8408aa6e66c12ede 100644 --- a/storage/xtradb/include/mem0mem.ic +++ b/storage/xtradb/include/mem0mem.ic @@ -305,8 +305,8 @@ mem_heap_free_heap_top( mem_block_set_free(block, old_top - (byte*) block); ut_ad(mem_block_get_start(block) <= mem_block_get_free(block)); - UNIV_MEM_ASSERT_W(old_top, (byte*) block + block->len - old_top); #if defined UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(old_top, (byte*)block + block->len - old_top); /* In the debug version erase block from top up */ mem_erase_buf(old_top, (byte*) block + block->len - old_top); @@ -315,7 +315,7 @@ mem_heap_free_heap_top( mem_current_allocated_memory -= (total_size - size); mutex_exit(&mem_hash_mutex); #endif /* UNIV_MEM_DEBUG */ - UNIV_MEM_ALLOC(old_top, (byte*) block + block->len - old_top); + UNIV_MEM_FREE(old_top, (byte*)block + block->len - old_top); /* If free == start, we may free the block if it is not the first one */ @@ -396,11 +396,11 @@ mem_heap_free_top( /* Subtract the free field of block */ mem_block_set_free(block, mem_block_get_free(block) - MEM_SPACE_NEEDED(n)); - UNIV_MEM_ASSERT_W((byte*) block + mem_block_get_free(block), n); #ifdef UNIV_MEM_DEBUG ut_ad(mem_block_get_start(block) <= mem_block_get_free(block)); + UNIV_MEM_ALLOC((byte*) block + mem_block_get_free(block), n); /* In the debug version check the consistency, and erase field */ mem_field_erase((byte*) block + mem_block_get_free(block), n); #endif @@ -412,11 +412,7 @@ mem_heap_free_top( == mem_block_get_start(block))) { mem_heap_block_free(heap, block); } else { - /* Avoid a bogus UNIV_MEM_ASSERT_W() warning in a - subsequent invocation of mem_heap_free_top(). - Originally, this was UNIV_MEM_FREE(), to catch writes - to freed memory. */ - UNIV_MEM_ALLOC((byte*) block + mem_block_get_free(block), n); + UNIV_MEM_FREE((byte*) block + mem_block_get_free(block), n); } } diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h index ef6cd61719d869c714a3f3cc8c188c05292aaaff..42a57f1022a1e3cd621b6e61d33af97103d866da 100644 --- a/storage/xtradb/include/mtr0mtr.h +++ b/storage/xtradb/include/mtr0mtr.h @@ -35,7 +35,6 @@ Created 11/26/1995 Heikki Tuuri #include "ut0byte.h" #include "mtr0types.h" #include "page0types.h" -#include "trx0types.h" /* Logging modes for a mini-transaction */ #define MTR_LOG_ALL 21 /* default mode: log all operations @@ -209,15 +208,6 @@ functions). The page number parameter was originally written as 0. @{ */ /* included here because it needs MLOG_LSN defined */ #include "log0log.h" -/***************************************************************//** -Starts a mini-transaction. */ -UNIV_INLINE -void -mtr_start_trx( -/*======*/ - mtr_t* mtr, /*!< out: mini-transaction */ - trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull (1))); /***************************************************************//** Starts a mini-transaction. */ UNIV_INLINE @@ -225,10 +215,7 @@ void mtr_start( /*======*/ mtr_t* mtr) /*!< out: mini-transaction */ -{ - mtr_start_trx(mtr, NULL); -} - MY_ATTRIBUTE((nonnull)) + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Commits a mini-transaction. */ UNIV_INTERN @@ -435,7 +422,6 @@ struct mtr_t{ #ifdef UNIV_DEBUG ulint magic_n; #endif /* UNIV_DEBUG */ - trx_t* trx; /*!< transaction */ }; #ifdef UNIV_DEBUG diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic index a6d9df099257e55af8fdd2fefc08f029e27cf73a..04c39cf7f7ee7174e11125bc122a428ff29d99de 100644 --- a/storage/xtradb/include/mtr0mtr.ic +++ b/storage/xtradb/include/mtr0mtr.ic @@ -43,10 +43,9 @@ mtr_block_dirtied( Starts a mini-transaction. */ UNIV_INLINE void -mtr_start_trx( +mtr_start( /*======*/ - mtr_t* mtr, /*!< out: mini-transaction */ - trx_t* trx) /*!< in: transaction */ + mtr_t* mtr) /*!< out: mini-transaction */ { UNIV_MEM_INVALID(mtr, sizeof *mtr); @@ -59,7 +58,6 @@ mtr_start_trx( mtr->made_dirty = FALSE; mtr->n_log_recs = 0; mtr->n_freed_pages = 0; - mtr->trx = trx; ut_d(mtr->state = MTR_ACTIVE); ut_d(mtr->magic_n = MTR_MAGIC_N); diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h index f69230240c5b25e659fe24d0a59a3ebd0f36f870..5e93b3454c73632559c50120bb855eb9d850bfda 100644 --- a/storage/xtradb/include/os0file.h +++ b/storage/xtradb/include/os0file.h @@ -382,11 +382,12 @@ The wrapper functions have the prefix of "innodb_". */ pfs_os_file_close_no_error_handling_func(file, __FILE__, __LINE__) # define os_aio(type, is_log, mode, name, file, buf, offset, \ - n, page_size, message1, message2, space_id, \ - trx, write_size) \ + n, page_size, message1, message2, space_id, \ + trx, write_size, should_buffer) \ pfs_os_aio_func(type, is_log, mode, name, file, buf, offset, \ - n, page_size, message1, message2, space_id, trx, write_size, \ - __FILE__, __LINE__) + n, page_size, message1, message2, space_id, \ + trx, write_size, should_buffer, \ + __FILE__, __LINE__) # define os_file_read(file, buf, offset, n) \ pfs_os_file_read_func(file, buf, offset, n, NULL, \ @@ -454,10 +455,12 @@ to original un-instrumented file I/O APIs */ # define os_file_close_no_error_handling(file) \ os_file_close_no_error_handling_func(file) -# define os_aio(type, is_log, mode, name, file, buf, offset, n, page_size, message1, \ - message2, space_id, trx, write_size) \ +# define os_aio(type, is_log, mode, name, file, buf, offset, \ + n, page_size, message1, \ + message2, space_id, trx, write_size, should_buffer) \ os_aio_func(type, is_log, mode, name, file, buf, offset, n, \ - page_size, message1, message2, space_id, trx, write_size) + page_size, message1, message2, space_id, \ + trx, write_size, should_buffer) # define os_file_read(file, buf, offset, n) \ os_file_read_func(file, buf, offset, n, NULL) @@ -939,6 +942,12 @@ pfs_os_aio_func( operation for this page and if initialized we do not trim again if actual page size does not decrease. */ + bool should_buffer, + /*!< in: Whether to buffer an aio request. + AIO read ahead uses this. If you plan to + use this parameter, make sure you remember + to call os_aio_dispatch_read_array_submit() + when you're ready to commit all your requests.*/ const char* src_file,/*!< in: file name where func invoked */ ulint src_line);/*!< in: line where the func invoked */ /*******************************************************************//** @@ -1359,11 +1368,17 @@ os_aio_func( OS_AIO_SYNC */ ulint space_id, trx_t* trx, - ulint* write_size);/*!< in/out: Actual write size initialized + ulint* write_size,/*!< in/out: Actual write size initialized after fist successfull trim operation for this page and if initialized we do not trim again if actual page size does not decrease. */ + bool should_buffer); + /*!< in: Whether to buffer an aio request. + AIO read ahead uses this. If you plan to + use this parameter, make sure you remember + to call os_aio_dispatch_read_array_submit() + when you're ready to commit all your requests.*/ /************************************************************************//** Wakes up all async i/o threads so that they know to exit themselves in shutdown. */ @@ -1547,6 +1562,10 @@ os_file_handle_error_no_exit( ibool on_error_silent);/*!< in: if TRUE then don't print any message to the log. */ +/** Submit buffered AIO requests on the given segment to the kernel. */ +UNIV_INTERN +void +os_aio_dispatch_read_array_submit(); /***********************************************************************//** Try to get number of bytes per sector from file system. diff --git a/storage/xtradb/include/os0file.ic b/storage/xtradb/include/os0file.ic index 72ac9d9dd6a083156529eb4a7bc38a7974738e1c..a2011da354591731eba79c1f4aa0c94002995a6d 100644 --- a/storage/xtradb/include/os0file.ic +++ b/storage/xtradb/include/os0file.ic @@ -258,6 +258,9 @@ pfs_os_aio_func( operation for this page and if initialized we do not trim again if actual page size does not decrease. */ + bool should_buffer, + /*!< in: whether to buffer an aio request. + Only used by aio read ahead*/ const char* src_file,/*!< in: file name where func invoked */ ulint src_line)/*!< in: line where the func invoked */ { @@ -274,7 +277,7 @@ pfs_os_aio_func( result = os_aio_func(type, is_log, mode, name, file, buf, offset, n, page_size, message1, message2, space_id, trx, - write_size); + write_size, should_buffer); register_pfs_file_io_end(locker, n); diff --git a/storage/xtradb/include/rem0rec.ic b/storage/xtradb/include/rem0rec.ic index 5811a77a48b765b16d2f77162b3abc261e52aee5..89f6902059dcb63f66e7e33ad9cfb136095cd073 100644 --- a/storage/xtradb/include/rem0rec.ic +++ b/storage/xtradb/include/rem0rec.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -922,7 +923,7 @@ rec_offs_set_n_alloc( { ut_ad(offsets); ut_ad(n_alloc > REC_OFFS_HEADER_SIZE); - UNIV_MEM_ASSERT_AND_ALLOC(offsets, n_alloc * sizeof *offsets); + UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets); offsets[0] = n_alloc; } diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h index 4326f1208e5e89e5e11b015b9618ba9bad0b693b..4915e7c7a312b15eea9998bf279c560cb50feb0e 100644 --- a/storage/xtradb/include/row0mysql.h +++ b/storage/xtradb/include/row0mysql.h @@ -591,18 +591,6 @@ void row_mysql_close(void); /*=================*/ -/*********************************************************************//** -Reassigns the table identifier of a table. -@return error code or DB_SUCCESS */ -UNIV_INTERN -dberr_t -row_mysql_table_id_reassign( -/*========================*/ - dict_table_t* table, /*!< in/out: table */ - trx_t* trx, /*!< in/out: transaction */ - table_id_t* new_id) /*!< out: new table id */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); - /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. This template struct is used to speed up row transformations between diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index e7f6350987efc27156bb31efa268113fe864f5f9..6df60e0e52d44f02ce328acfdb68e1e0ba07f327 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -195,6 +195,9 @@ struct srv_stats_t { wait timeout */ ulint_ctr_1_t n_lock_max_wait_time; + /** Number of buffered aio requests submitted */ + ulint_ctr_64_t n_aio_submitted; + /** Number of times page 0 is read from tablespace */ ulint_ctr_64_t page0_read; @@ -720,6 +723,9 @@ extern ulong srv_sync_array_size; /* print all user-level transactions deadlocks to mysqld stderr */ extern my_bool srv_print_all_deadlocks; +/* print lock wait timeout info to mysqld stderr */ +extern my_bool srv_print_lock_wait_timeout_info; + extern my_bool srv_cmp_per_index_enabled; /* is encryption enabled */ @@ -1294,7 +1300,9 @@ struct export_var_t{ ib_int64_t innodb_n_rowlog_blocks_decrypted; ulint innodb_sec_rec_cluster_reads; /*!< srv_sec_rec_cluster_reads */ - ulint innodb_sec_rec_cluster_reads_avoided;/*!< srv_sec_rec_cluster_reads_avoided */ + ulint innodb_sec_rec_cluster_reads_avoided; /*!< srv_sec_rec_cluster_reads_avoided */ + + ulint innodb_buffered_aio_submitted; ulint innodb_encryption_rotation_pages_read_from_cache; ulint innodb_encryption_rotation_pages_read_from_disk; diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h index 630818a8648d59da86686dd617abb1b753a5761e..fef12548003c9aefb92ec5955b106890e682085c 100644 --- a/storage/xtradb/include/trx0rec.h +++ b/storage/xtradb/include/trx0rec.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -196,6 +196,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used @@ -228,7 +229,7 @@ trx_undo_report_row_operation( const ulint* offsets, /*!< in: rec_get_offsets(rec) */ roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the undo log record */ - MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result)); + MY_ATTRIBUTE((nonnull(2,8), warn_unused_result)); /******************************************************************//** Copies an undo record to heap. This function can be called if we know that the undo log record exists. diff --git a/storage/xtradb/include/trx0undo.h b/storage/xtradb/include/trx0undo.h index 190308112ba9a564ca5cc5f0903739070584b1bc..0148cc61579360a9f311e580604804be88a5c559 100644 --- a/storage/xtradb/include/trx0undo.h +++ b/storage/xtradb/include/trx0undo.h @@ -243,13 +243,22 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end( +trx_undo_truncate_end_func( /*=======================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction whose undo log it is */ +#endif /* UNIV_DEBUG */ trx_undo_t* undo, /*!< in/out: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ MY_ATTRIBUTE((nonnull)); +#ifdef UNIV_DEBUG +# define trx_undo_truncate_end(trx,undo,limit) \ + trx_undo_truncate_end_func(trx,undo,limit) +#else /* UNIV_DEBUG */ +# define trx_undo_truncate_end(trx,undo,limit) \ + trx_undo_truncate_end_func(undo,limit) +#endif /* UNIV_DEBUG */ /***********************************************************************//** Truncates an undo log from the start. This function is used during a purge diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 5886b078e4debf344c35335a4a38063817135c97..93ab71bf46c856810723ad927aa63cd9d9c50c27 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -48,7 +48,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_BUGFIX 36 #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 82.2 +#define PERCONA_INNODB_VERSION 83.0 #endif /* Enable UNIV_LOG_ARCHIVE in XtraDB */ @@ -691,14 +691,6 @@ typedef void* os_thread_ret_t; # define UNIV_MEM_ASSERT_W(addr, size) do {} while(0) # define UNIV_MEM_TRASH(addr, c, size) do {} while(0) #endif -#define UNIV_MEM_ASSERT_AND_FREE(addr, size) do { \ - UNIV_MEM_ASSERT_W(addr, size); \ - UNIV_MEM_FREE(addr, size); \ -} while (0) -#define UNIV_MEM_ASSERT_AND_ALLOC(addr, size) do { \ - UNIV_MEM_ASSERT_W(addr, size); \ - UNIV_MEM_ALLOC(addr, size); \ -} while (0) extern ulong srv_page_size_shift; extern ulong srv_page_size; diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 20e3f5adeb73543ac165f8adfbf612fec729347b..a9077cb19a37c401abfcc41992b5bc5389aeeaf2 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation +Copyright (c) 2014, 2018, 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 @@ -6970,7 +6970,7 @@ lock_rec_block_validate( /* Make sure that the tablespace is not deleted while we are trying to access the page. */ - if (fil_space_t* space = fil_space_acquire(space_id)) { + if (fil_space_t* space = fil_space_acquire_silent(space_id)) { mtr_start(&mtr); block = buf_page_get_gen( diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc index a0f557e18e5a87db75851db1fc853d4beaabef22..da4b0301df866fe4f56ec81822154bd45cc6c096 100644 --- a/storage/xtradb/lock/lock0wait.cc +++ b/storage/xtradb/lock/lock0wait.cc @@ -33,6 +33,20 @@ Created 25/5/2010 Sunny Bains #include "srv0start.h" #include "ha_prototypes.h" #include "lock0priv.h" +#include "lock0iter.h" + +#include + +extern "C" +LEX_STRING* thd_query_string(MYSQL_THD thd); + +struct blocking_trx_info { + uint64_t trx_id; + uint32_t thread_id; + int64_t query_id; +}; + +static const size_t MAX_BLOCKING_TRX_IN_REPORT = 10; #include @@ -187,6 +201,46 @@ lock_wait_table_reserve_slot( return(NULL); } +/** Print lock wait timeout info to stderr. It's supposed this function +is executed in trx's THD thread as it calls some non-thread-safe +functions to get some info from THD. +@param[in] trx requested trx +@param[in] blocking blocking info array +@param[in] blocking_count blocking info array size */ +void +print_lock_wait_timeout( + const trx_t &trx, + blocking_trx_info *blocking, + size_t blocking_count) +{ + std::ostringstream outs; + + outs << "Lock wait timeout info:\n"; + outs << "Requested thread id: " << + thd_get_thread_id(trx.mysql_thd) << + "\n"; + outs << "Requested trx id: " << trx.id << "\n"; + outs << "Requested query: " << + thd_query_string(trx.mysql_thd)->str << "\n"; + + outs << "Total blocking transactions count: " << + blocking_count << + "\n"; + + for (size_t i = 0; i < blocking_count; ++i) { + outs << "Blocking transaction number: " << (i + 1) << "\n"; + outs << "Blocking thread id: " << + blocking[i].thread_id << + "\n"; + outs << "Blocking query id: " << + blocking[i].query_id << + "\n"; + outs << "Blocking trx id: " << blocking[i].trx_id << "\n"; + } + ut_print_timestamp(stderr); + fprintf(stderr, " %s", outs.str().c_str()); +} + #ifdef WITH_WSREP /*********************************************************************//** check if lock timeout was for priority thread, @@ -235,6 +289,8 @@ lock_wait_suspend_thread( ulint sec; ulint ms; ulong lock_wait_timeout; + blocking_trx_info blocking[MAX_BLOCKING_TRX_IN_REPORT]; + size_t blocking_count = 0; trx = thr_get_trx(thr); @@ -411,6 +467,8 @@ lock_wait_suspend_thread( #endif /* WITH_WSREP */ trx->error_state = DB_LOCK_WAIT_TIMEOUT; + if (srv_print_lock_wait_timeout_info) + print_lock_wait_timeout(*trx, blocking, blocking_count); #ifdef WITH_WSREP } diff --git a/storage/xtradb/log/log0crypt.cc b/storage/xtradb/log/log0crypt.cc index a5fbbab17efcf40b49d1157b7feecd0d684d0ed5..2a0a7abb6869ef260b61c2ebdb337429ff6ef14a 100644 --- a/storage/xtradb/log/log0crypt.cc +++ b/storage/xtradb/log/log0crypt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2018, 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 @@ -69,22 +69,6 @@ struct crypt_info_t { static std::deque crypt_info; -/*********************************************************************//** -Get a log block's start lsn. -@return a log block's start lsn */ -static inline -lsn_t -log_block_get_start_lsn( -/*====================*/ - lsn_t lsn, /*!< in: checkpoint lsn */ - ulint log_block_no) /*!< in: log block number */ -{ - lsn_t start_lsn = - (lsn & (lsn_t)0xffffffff00000000ULL) | - (((log_block_no - 1) & (lsn_t)0x3fffffff) << 9); - return start_lsn; -} - /*********************************************************************//** Get crypt info from checkpoint. @return a crypt info or NULL if not present. */ @@ -161,6 +145,8 @@ Crypt_result log_blocks_crypt( /*=============*/ const byte* block, /*!< in: blocks before encrypt/decrypt*/ + lsn_t lsn, /*!< in: log sequence number of the start + of the buffer */ ulint size, /*!< in: size of block */ byte* dst_block, /*!< out: blocks after encrypt/decrypt */ int what, /*!< in: encrypt or decrypt*/ @@ -170,21 +156,18 @@ log_blocks_crypt( Crypt_result rc = MY_AES_OK; uint dst_len; byte aes_ctr_counter[MY_AES_BLOCK_SIZE]; - byte is_encrypt= what == ENCRYPTION_FLAG_ENCRYPT; - lsn_t lsn = is_encrypt ? log_sys->lsn : srv_start_lsn; const uint src_len = OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE; - for (ulint i = 0; i < size ; i += OS_FILE_LOG_BLOCK_SIZE) { + for (ulint i = 0; i < size ; i += OS_FILE_LOG_BLOCK_SIZE, + lsn += OS_FILE_LOG_BLOCK_SIZE) { ulint log_block_no = log_block_get_hdr_no(log_block); - lsn_t log_block_start_lsn = log_block_get_start_lsn( - lsn, log_block_no); const crypt_info_t* info = crypt_info == NULL ? get_crypt_info(log_block) : crypt_info; #ifdef DEBUG_CRYPT fprintf(stderr, "%s %lu chkpt: %lu key: %u lsn: %lu\n", - is_encrypt ? "crypt" : "decrypt", + what == ENCRYPTION_FLAG_ENCRYPT ? "crypt" : "decrypt", log_block_no, log_block_get_checkpoint_no(log_block), info ? info->key_version : 0, @@ -213,7 +196,7 @@ log_blocks_crypt( // (1-byte, only 5 bits are used). "+" means concatenate. bzero(aes_ctr_counter, MY_AES_BLOCK_SIZE); memcpy(aes_ctr_counter, info->crypt_nonce, 3); - mach_write_to_8(aes_ctr_counter + 3, log_block_start_lsn); + mach_write_to_8(aes_ctr_counter + 3, lsn); mach_write_to_4(aes_ctr_counter + 11, log_block_no); bzero(aes_ctr_counter + 15, 1); @@ -458,19 +441,6 @@ add_crypt_info( return true; } -/*********************************************************************//** -Encrypt log blocks. */ -UNIV_INTERN -Crypt_result -log_blocks_encrypt( -/*===============*/ - const byte* block, /*!< in: blocks before encryption */ - const ulint size, /*!< in: size of blocks, must be multiple of a log block */ - byte* dst_block) /*!< out: blocks after encryption */ -{ - return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT, NULL); -} - /*********************************************************************//** Set next checkpoint's key version to latest one, and generate current key. Key version 0 means no encryption. */ @@ -522,6 +492,8 @@ log_encrypt_before_write( /*=====================*/ ib_uint64_t next_checkpoint_no, /*!< in: log group to be flushed */ byte* block, /*!< in/out: pointer to a log block */ + lsn_t lsn, /*!< in: log sequence number of + the start of the buffer */ const ulint size) /*!< in: size of log blocks */ { ut_ad(size % OS_FILE_LOG_BLOCK_SIZE == 0); @@ -540,7 +512,8 @@ log_encrypt_before_write( byte* dst_frame = (byte*)malloc(size); //encrypt log blocks content - Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL); + Crypt_result result = log_blocks_crypt( + block, lsn, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL); if (result == MY_AES_OK) { ut_ad(block[0] == dst_frame[0]); @@ -560,13 +533,16 @@ void log_decrypt_after_read( /*===================*/ byte* frame, /*!< in/out: log segment */ + lsn_t lsn, /*!< in: log sequence number of the start + of the buffer */ const ulint size) /*!< in: log segment size */ { ut_ad(size % OS_FILE_LOG_BLOCK_SIZE == 0); byte* dst_frame = (byte*)malloc(size); // decrypt log blocks content - Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL); + Crypt_result result = log_blocks_crypt( + frame, lsn, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL); if (result == MY_AES_OK) { memcpy(frame, dst_frame, size); diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 1542f4a646f749e0ad9d7ad8d561e0d4f2915488..8f8984f8880fd720dd3af4cdeb6bc2cd56c64709 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -1490,7 +1490,7 @@ log_group_write_buf( ut_a(next_offset / UNIV_PAGE_SIZE <= ULINT_MAX); log_encrypt_before_write(log_sys->next_checkpoint_no, - buf, write_len); + buf, start_lsn, write_len); #ifdef DEBUG_CRYPT fprintf(stderr, "WRITE: block: %lu checkpoint: %lu %.8lx %.8lx\n", @@ -2582,7 +2582,7 @@ log_group_read_log_seg( log_block_get_checksum(buf), source_offset); #endif - log_decrypt_after_read(buf, len); + log_decrypt_after_read(buf, start_lsn, len); #ifdef DEBUG_CRYPT fprintf(stderr, "AFTER DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx\n", @@ -2890,7 +2890,8 @@ log_group_archive( MONITOR_INC(MONITOR_LOG_IO); //TODO (jonaso): This must be dead code?? - log_encrypt_before_write(log_sys->next_checkpoint_no, buf, len); + log_encrypt_before_write(log_sys->next_checkpoint_no, + buf, start_lsn, len); fil_io(OS_FILE_WRITE | OS_FILE_LOG, false, group->archive_space_id, 0, diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc index 27382977e5ccec4442e770c0c6d044d9c8631315..af32237243b3c178665ac81a18b6d9e8a54c94a2 100644 --- a/storage/xtradb/log/log0online.cc +++ b/storage/xtradb/log/log0online.cc @@ -479,9 +479,9 @@ log_online_make_bitmap_name( /*=========================*/ lsn_t start_lsn) /*!< in: the start LSN name part */ { - ut_snprintf(log_bmp_sys->out.name, FN_REFLEN, bmp_file_name_template, - log_bmp_sys->bmp_file_home, bmp_file_name_stem, - log_bmp_sys->out_seq_num, start_lsn); + ut_snprintf(log_bmp_sys->out.name, sizeof(log_bmp_sys->out.name), + bmp_file_name_template, log_bmp_sys->bmp_file_home, + bmp_file_name_stem, log_bmp_sys->out_seq_num, start_lsn); } /*********************************************************************//** diff --git a/storage/xtradb/mem/mem0mem.cc b/storage/xtradb/mem/mem0mem.cc index e066aff5b300000b5ab54ffd1eaad693cc51a0fd..b9f190509eebb549a5e9c3302be21928990953de 100644 --- a/storage/xtradb/mem/mem0mem.cc +++ b/storage/xtradb/mem/mem0mem.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -506,13 +507,13 @@ mem_heap_block_free( #ifndef UNIV_HOTBACKUP if (!srv_use_sys_malloc) { #ifdef UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(block, len); /* In the debug version we set the memory to a random combination of hex 0xDE and 0xAD. */ - mem_erase_buf((byte*) block, len); -#else /* UNIV_MEM_DEBUG */ - UNIV_MEM_ASSERT_AND_FREE(block, len); + mem_erase_buf((byte*)block, len); #endif /* UNIV_MEM_DEBUG */ + UNIV_MEM_FREE(block, len); } if (type == MEM_HEAP_DYNAMIC || len < UNIV_PAGE_SIZE / 2) { @@ -526,13 +527,13 @@ mem_heap_block_free( } #else /* !UNIV_HOTBACKUP */ #ifdef UNIV_MEM_DEBUG + UNIV_MEM_ALLOC(block, len); /* In the debug version we set the memory to a random combination of hex 0xDE and 0xAD. */ - mem_erase_buf((byte*) block, len); -#else /* UNIV_MEM_DEBUG */ - UNIV_MEM_ASSERT_AND_FREE(block, len); + mem_erase_buf((byte*)block, len); #endif /* UNIV_MEM_DEBUG */ + UNIV_MEM_FREE(block, len); ut_free(block); #endif /* !UNIV_HOTBACKUP */ } diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 8b0fa059100c0b339b19847c434267e5bea666f2..634ebb2af4956689a978e6dbefcc4164ca4ce3ac 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -296,6 +296,16 @@ struct os_aio_array_t{ There is one such event for each possible pending IO. The size of the array is equal to n_slots. */ + struct iocb** pending; + /* Array to buffer the not-submitted aio + requests. The array length is n_slots. + It is divided into n_segments segments. + pending requests on each segment are buffered + separately.*/ + ulint* count; + /* Array of length n_segments. Each element + counts the number of not-submitted aio + request on that segment.*/ #endif /* LINUX_NATIV_AIO */ }; @@ -4276,6 +4286,13 @@ os_aio_array_create( memset(io_event, 0x0, sizeof(*io_event) * n); array->aio_events = io_event; + array->pending = static_cast( + ut_malloc(n * sizeof(struct iocb*))); + memset(array->pending, 0x0, sizeof(struct iocb*) * n); + array->count = static_cast( + ut_malloc(n_segments * sizeof(ulint))); + memset(array->count, 0x0, sizeof(ulint) * n_segments); + skip_native_aio: #endif /* LINUX_NATIVE_AIO */ for (ulint i = 0; i < n; i++) { @@ -4310,6 +4327,16 @@ os_aio_array_free( if (srv_use_native_aio) { ut_free(array->aio_events); ut_free(array->aio_ctx); + +#ifdef UNIV_DEBUG + for (size_t idx = 0; idx < array->n_slots; ++idx) + ut_ad(array->pending[idx] == NULL); + for (size_t idx = 0; idx < array->n_segments; ++idx) + ut_ad(array->count[idx] == 0); +#endif + + ut_free(array->pending); + ut_free(array->count); } #endif /* LINUX_NATIVE_AIO */ @@ -4957,6 +4984,83 @@ readahead requests. */ } #endif /* _WIN32 */ +/** Submit buffered AIO requests on the given segment to the kernel +(low level function). +@param acquire_mutex specifies whether to lock array mutex +*/ +static +void +os_aio_dispatch_read_array_submit_low(bool acquire_mutex MY_ATTRIBUTE((unused))) +{ + if (!srv_use_native_aio) { + return; + } +#if defined(LINUX_NATIVE_AIO) + os_aio_array_t* array = os_aio_read_array; + ulint total_submitted = 0; + if (acquire_mutex) + os_mutex_enter(array->mutex); + /* Submit aio requests buffered on all segments. */ + for (ulint i = 0; i < array->n_segments; i++) { + const int count = array->count[i]; + int offset = 0; + while (offset != count) { + struct iocb** const iocb_array = array->pending + + i * array->n_slots / array->n_segments + + offset; + const int partial_count = count - offset; + /* io_submit() returns number of successfully queued + requests or (-errno). + It returns 0 only if the number of iocb blocks passed + is also 0. */ + const int submitted = io_submit(array->aio_ctx[i], + partial_count, iocb_array); + + /* This assertion prevents infinite loop in both + debug and release modes. */ + ut_a(submitted != 0); + + if (submitted < 0) { + /* Terminating with fatal error */ + const char* errmsg = + strerror(-submitted); + ib_logf(IB_LOG_LEVEL_FATAL, + "Trying to sumbit %d aio requests, " + "io_submit() set errno to %d: %s", + partial_count, -submitted, + errmsg ? errmsg : ""); + } + ut_ad(submitted <= partial_count); + if (submitted < partial_count) + { + ib_logf(IB_LOG_LEVEL_WARN, + "Trying to sumbit %d aio requests, " + "io_submit() submitted only %d", + partial_count, submitted); + } + offset += submitted; + } + total_submitted += count; + } + /* Reset the aio request buffer. */ + memset(array->pending, 0x0, sizeof(struct iocb*) * array->n_slots); + memset(array->count, 0x0, sizeof(ulint) * array->n_segments); + + if (acquire_mutex) + os_mutex_exit(array->mutex); + + srv_stats.n_aio_submitted.add(total_submitted); +#endif +} + +/** Submit buffered AIO requests on the given segment to the kernel. */ +UNIV_INTERN +void +os_aio_dispatch_read_array_submit() +{ + os_aio_dispatch_read_array_submit_low(true); +} + #if defined(LINUX_NATIVE_AIO) /*******************************************************************//** Dispatch an AIO request to the kernel. @@ -4966,10 +5070,11 @@ ibool os_aio_linux_dispatch( /*==================*/ os_aio_array_t* array, /*!< in: io request array. */ - os_aio_slot_t* slot) /*!< in: an already reserved slot. */ + os_aio_slot_t* slot, /*!< in: an already reserved slot. */ + bool should_buffer) /*!< in: should buffer the request + rather than submit. */ { int ret; - ulint io_ctx_index; struct iocb* iocb; ut_ad(slot != NULL); @@ -4981,9 +5086,31 @@ os_aio_linux_dispatch( The iocb struct is directly in the slot. The io_context is one per segment. */ + ulint slots_per_segment = array->n_slots / array->n_segments; iocb = &slot->control; - io_ctx_index = (slot->pos * array->n_segments) / array->n_slots; + ulint io_ctx_index = slot->pos / slots_per_segment; + if (should_buffer) { + ut_ad(array == os_aio_read_array); + os_mutex_enter(array->mutex); + /* There are array->n_slots elements in array->pending, + which is divided into array->n_segments area of equal size. + The iocb of each segment are buffered in its corresponding area + in the pending array consecutively as they come. + array->count[i] records the number of buffered aio requests + in the ith segment.*/ + ulint& count = array->count[io_ctx_index]; + ut_ad(count != slots_per_segment); + ulint n = io_ctx_index * slots_per_segment + count; + array->pending[n] = iocb; + ++count; + if (count == slots_per_segment) { + os_aio_dispatch_read_array_submit_low(false); + } + os_mutex_exit(array->mutex); + return(TRUE); + } + /* Submit the given request. */ ret = io_submit(array->aio_ctx[io_ctx_index], 1, &iocb); #if defined(UNIV_AIO_DEBUG) @@ -5046,11 +5173,17 @@ os_aio_func( OS_AIO_SYNC */ ulint space_id, trx_t* trx, - ulint* write_size)/*!< in/out: Actual write size initialized + ulint* write_size,/*!< in/out: Actual write size initialized after fist successfull trim operation for this page and if initialized we do not trim again if actual page size does not decrease. */ + bool should_buffer) + /*!< in: Whether to buffer an aio request. + AIO read ahead uses this. If you plan to + use this parameter, make sure you remember + to call os_aio_dispatch_read_array_submit() + when you're ready to commit all your requests.*/ { os_aio_array_t* array; os_aio_slot_t* slot; @@ -5168,7 +5301,8 @@ os_aio_func( goto err_exit; #elif defined(LINUX_NATIVE_AIO) - if (!os_aio_linux_dispatch(array, slot)) { + if (!os_aio_linux_dispatch(array, slot, + should_buffer)) { goto err_exit; } #endif /* WIN_ASYNC_IO */ @@ -5192,7 +5326,7 @@ os_aio_func( if(!ret && GetLastError() != ERROR_IO_PENDING) goto err_exit; #elif defined(LINUX_NATIVE_AIO) - if (!os_aio_linux_dispatch(array, slot)) { + if (!os_aio_linux_dispatch(array, slot, false)) { goto err_exit; } #endif /* WIN_ASYNC_IO */ diff --git a/storage/xtradb/page/page0page.cc b/storage/xtradb/page/page0page.cc index 800f76e1532f0a36292bc47aa470ffd323b10086..fc93eebd445654297e3261f92d84bb5680bc1129 100644 --- a/storage/xtradb/page/page0page.cc +++ b/storage/xtradb/page/page0page.cc @@ -2839,7 +2839,7 @@ page_warn_strict_checksum( ulint space_id, ulint page_no) { - srv_checksum_algorithm_t curr_algo_nonstrict; + srv_checksum_algorithm_t curr_algo_nonstrict = srv_checksum_algorithm_t(); switch (curr_algo) { case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32: curr_algo_nonstrict = SRV_CHECKSUM_ALGORITHM_CRC32; diff --git a/storage/xtradb/rem/rem0rec.cc b/storage/xtradb/rem/rem0rec.cc index c62e8c9043405366059677b6c7b24b9eedb87eb3..2314f110312c8a2be76f8c1544e4d558a39797bc 100644 --- a/storage/xtradb/rem/rem0rec.cc +++ b/storage/xtradb/rem/rem0rec.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -865,13 +865,10 @@ rec_get_converted_size_comp_prefix_low( if (fixed_len) { #ifdef UNIV_DEBUG - ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); - ut_ad(len <= fixed_len); - ut_ad(!mbmaxlen || len >= mbminlen - * (fixed_len / mbmaxlen)); + ut_ad(!col->mbmaxlen || len >= col->mbminlen + * (fixed_len / col->mbmaxlen)); /* dict_index_add_col() should guarantee this */ ut_ad(!field->prefix_len @@ -1259,14 +1256,10 @@ rec_convert_dtuple_to_rec_comp( it is 128 or more, or when the field is stored externally. */ if (fixed_len) { #ifdef UNIV_DEBUG - ulint mbminlen = DATA_MBMINLEN( - ifield->col->mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN( - ifield->col->mbminmaxlen); - ut_ad(len <= fixed_len); - ut_ad(!mbmaxlen || len >= mbminlen - * (fixed_len / mbmaxlen)); + ut_ad(!ifield->col->mbmaxlen + || len >= ifield->col->mbminlen + * (fixed_len / ifield->col->mbmaxlen)); ut_ad(!dfield_is_ext(field)); #endif /* UNIV_DEBUG */ } else if (dfield_is_ext(field)) { diff --git a/storage/xtradb/row/row0ext.cc b/storage/xtradb/row/row0ext.cc index ad852577ad2376d0d9a0ce685b697bd206a5d4a8..32b78391d6a66297aa80d7efbcfb9ffa10677476 100644 --- a/storage/xtradb/row/row0ext.cc +++ b/storage/xtradb/row/row0ext.cc @@ -78,8 +78,7 @@ row_ext_cache_fill( crashed during the execution of btr_free_externally_stored_field(). */ ext->len[i] = btr_copy_externally_stored_field_prefix( - buf, ext->max_len, zip_size, field, f_len, - NULL); + buf, ext->max_len, zip_size, field, f_len); } } } diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc index 0f9c15f6a695d3a400332e7a593aeeeb4bc8ae9f..bd57685b71c9822e3c72fa6d83f744edf9cfcc16 100644 --- a/storage/xtradb/row/row0ftsort.cc +++ b/storage/xtradb/row/row0ftsort.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, 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 @@ -106,8 +106,9 @@ row_merge_create_fts_sort_index( field->col->prtype = idx_field->col->prtype | DATA_NOT_NULL; field->col->mtype = charset == &my_charset_latin1 ? DATA_VARCHAR : DATA_VARMYSQL; - field->col->mbminmaxlen = idx_field->col->mbminmaxlen; - field->col->len = HA_FT_MAXCHARLEN * DATA_MBMAXLEN(field->col->mbminmaxlen); + field->col->mbminlen = idx_field->col->mbminlen; + field->col->mbmaxlen = idx_field->col->mbmaxlen; + field->col->len = HA_FT_MAXCHARLEN * field->col->mbmaxlen; field->fixed_len = 0; @@ -150,7 +151,8 @@ row_merge_create_fts_sort_index( field->col->prtype = DATA_NOT_NULL | DATA_BINARY_TYPE; - field->col->mbminmaxlen = 0; + field->col->mbminlen = 0; + field->col->mbmaxlen = 0; /* The third field is on the word's position in the original doc */ field = dict_index_get_nth_field(new_index, 2); @@ -162,7 +164,8 @@ row_merge_create_fts_sort_index( field->col->len = 4 ; field->fixed_len = 4; field->col->prtype = DATA_NOT_NULL; - field->col->mbminmaxlen = 0; + field->col->mbminlen = 0; + field->col->mbmaxlen = 0; return(new_index); } @@ -540,7 +543,8 @@ row_merge_fts_doc_tokenize( field->type.mtype = DATA_INT; field->type.prtype = DATA_NOT_NULL | DATA_BINARY_TYPE; field->type.len = len; - field->type.mbminmaxlen = 0; + field->type.mbminlen = 0; + field->type.mbmaxlen = 0; cur_len += len; dfield_dup(field, buf->heap); @@ -559,7 +563,8 @@ row_merge_fts_doc_tokenize( field->type.mtype = DATA_INT; field->type.prtype = DATA_NOT_NULL; field->type.len = len; - field->type.mbminmaxlen = 0; + field->type.mbminlen = 0; + field->type.mbmaxlen = 0; cur_len += len; dfield_dup(field, buf->heap); @@ -709,8 +714,7 @@ fts_parallel_tokenization( doc.text.f_str = btr_copy_externally_stored_field( &doc.text.f_len, data, - zip_size, data_len, blob_heap, - NULL); + zip_size, data_len, blob_heap); } else { doc.text.f_str = data; doc.text.f_len = data_len; diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc index 3efc2a30037c7a5b1284e0c69e7db9352893c353..f0035302852c4d7968c826fa267028864be61500 100644 --- a/storage/xtradb/row/row0import.cc +++ b/storage/xtradb/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, 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 @@ -1259,7 +1259,8 @@ row_import::match_table_columns( err = DB_ERROR; } - if (cfg_col->mbminmaxlen != col->mbminmaxlen) { + if (cfg_col->mbminlen != col->mbminlen + || cfg_col->mbmaxlen != col->mbmaxlen) { ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, @@ -2877,7 +2878,9 @@ row_import_read_columns( col->len = mach_read_from_4(ptr); ptr += sizeof(ib_uint32_t); - col->mbminmaxlen = mach_read_from_4(ptr); + ulint mbminmaxlen = mach_read_from_4(ptr); + col->mbmaxlen = mbminmaxlen / 5; + col->mbminlen = mbminmaxlen % 5; ptr += sizeof(ib_uint32_t); col->ind = mach_read_from_4(ptr); diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc index f653a4df77da92d09df98c2d9e1d49bbced64507..472be8ad84876e482150c807270dce3852ad098f 100644 --- a/storage/xtradb/row/row0ins.cc +++ b/storage/xtradb/row/row0ins.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -571,7 +571,8 @@ row_ins_cascade_calc_update_vec( if (!dfield_is_null(&ufield->new_val) && dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, + col->mbminlen, col->mbmaxlen, col->len, ufield_len, static_cast( @@ -1330,7 +1331,7 @@ row_ins_foreign_check_on_constraint( row_mysql_freeze_data_dictionary(thr_get_trx(thr)); - mtr_start_trx(mtr, trx); + mtr_start(mtr); /* Restore pcur position */ @@ -1358,7 +1359,7 @@ row_ins_foreign_check_on_constraint( btr_pcur_store_position(pcur, mtr); mtr_commit(mtr); - mtr_start_trx(mtr, trx); + mtr_start(mtr); btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr); @@ -1571,7 +1572,7 @@ row_ins_check_foreign_constraint( } } - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Store old value on n_fields_cmp */ @@ -2390,7 +2391,7 @@ row_ins_clust_index_entry_low( search_mode = mode; } - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) { @@ -2628,10 +2629,9 @@ Starts a mini-transaction and checks if the index will be dropped. @return true if the index is to be dropped */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool -row_ins_sec_mtr_start_trx_and_check_if_aborted( +row_ins_sec_mtr_start_and_check_if_aborted( /*=======================================*/ mtr_t* mtr, /*!< out: mini-transaction */ - trx_t* trx, /*!< in: transaction handle */ dict_index_t* index, /*!< in/out: secondary index */ bool check, /*!< in: whether to check */ ulint search_mode) @@ -2639,7 +2639,7 @@ row_ins_sec_mtr_start_trx_and_check_if_aborted( { ut_ad(!dict_index_is_clust(index)); - mtr_start_trx(mtr, trx); + mtr_start(mtr); if (!check) { return(false); @@ -2697,14 +2697,13 @@ row_ins_sec_index_entry_low( ulint n_unique; mtr_t mtr; ulint* offsets = NULL; - trx_t* trx = thr_get_trx(thr); ut_ad(!dict_index_is_clust(index)); ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE); cursor.thr = thr; ut_ad(thr_get_trx(thr)->id); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* If running with fake_changes mode on then avoid using insert buffer and also switch from modify to search so that code takes only s-latch @@ -2766,7 +2765,7 @@ row_ins_sec_index_entry_low( if (err != DB_SUCCESS) { if (err == DB_DECRYPTION_FAILED) { - ib_push_warning(trx->mysql_thd, + ib_push_warning(thr_get_trx(thr)->mysql_thd, DB_DECRYPTION_FAILED, "Table %s is encrypted but encryption service or" " used key_id is not available. " @@ -2802,8 +2801,8 @@ row_ins_sec_index_entry_low( DEBUG_SYNC_C("row_ins_sec_index_unique"); - if (row_ins_sec_mtr_start_trx_and_check_if_aborted( - &mtr, trx, index, check, search_mode)) { + if (row_ins_sec_mtr_start_and_check_if_aborted( + &mtr, index, check, search_mode)) { goto func_exit; } @@ -2837,8 +2836,8 @@ row_ins_sec_index_entry_low( return(err); } - if (row_ins_sec_mtr_start_trx_and_check_if_aborted( - &mtr, trx, index, check, search_mode)) { + if (row_ins_sec_mtr_start_and_check_if_aborted( + &mtr, index, check, search_mode)) { goto func_exit; } @@ -3147,7 +3146,7 @@ row_ins_index_entry_set_vals( = dict_field_get_col(ind_field); len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, col->mbminlen, col->mbmaxlen, ind_field->prefix_len, len, static_cast( diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc index 82fde841f3910651a4dbe1dbbfb54f731091ec90..040fb37ee30e814d31e639cba22b19f365e090d2 100644 --- a/storage/xtradb/row/row0log.cc +++ b/storage/xtradb/row/row0log.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -1064,7 +1064,7 @@ row_log_table_get_pk_col( mem_heap_alloc(heap, field_len)); len = btr_copy_externally_stored_field_prefix( - blob_field, field_len, zip_size, field, len, NULL); + blob_field, field_len, zip_size, field, len); if (len >= max_len + 1) { return(DB_TOO_BIG_INDEX_COL); } @@ -1183,7 +1183,7 @@ row_log_table_get_pk( dict_field_t* ifield; dfield_t* dfield; ulint prtype; - ulint mbminmaxlen; + ulint mbminlen, mbmaxlen; ifield = dict_index_get_nth_field(new_index, new_i); dfield = dtuple_get_nth_field(tuple, new_i); @@ -1212,7 +1212,8 @@ row_log_table_get_pk( goto func_exit; } - mbminmaxlen = col->mbminmaxlen; + mbminlen = col->mbminlen; + mbmaxlen = col->mbmaxlen; prtype = col->prtype; } else { /* No matching column was found in the old @@ -1222,7 +1223,8 @@ row_log_table_get_pk( dfield_copy(dfield, dtuple_get_nth_field( log->add_cols, col_no)); - mbminmaxlen = dfield->type.mbminmaxlen; + mbminlen = dfield->type.mbminlen; + mbmaxlen = dfield->type.mbmaxlen; prtype = dfield->type.prtype; } @@ -1231,7 +1233,7 @@ row_log_table_get_pk( if (ifield->prefix_len) { ulint len = dtype_get_at_most_n_mbchars( - prtype, mbminmaxlen, + prtype, mbminlen, mbmaxlen, ifield->prefix_len, dfield_get_len(dfield), static_cast( @@ -1455,7 +1457,7 @@ row_log_table_apply_convert_mrec( data = btr_rec_copy_externally_stored_field( mrec, offsets, dict_table_zip_size(index->table), - i, &len, heap, NULL); + i, &len, heap); ut_a(data); dfield_set_data(dfield, data, len); blob_done: diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc index cbcc3cc62f3fd2bcf9d8d1102c7d4eb88ebf0d2f..d9585818577cac641ceaa7c01a34dc376adccc91 100644 --- a/storage/xtradb/row/row0merge.cc +++ b/storage/xtradb/row/row0merge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, 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 @@ -268,8 +268,8 @@ row_merge_buf_redundant_convert( mem_heap_t* heap, trx_t* trx) { - ut_ad(DATA_MBMINLEN(field->type.mbminmaxlen) == 1); - ut_ad(DATA_MBMAXLEN(field->type.mbminmaxlen) > 1); + ut_ad(field->type.mbminlen == 1); + ut_ad(field->type.mbmaxlen > 1); byte* buf = (byte*) mem_heap_alloc(heap, len); ulint field_len = row_field->len; @@ -285,7 +285,7 @@ row_merge_buf_redundant_convert( field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE)); byte* data = btr_copy_externally_stored_field( - &ext_len, field_data, zip_size, field_len, heap, trx); + &ext_len, field_data, zip_size, field_len, heap); ut_ad(ext_len < len); @@ -396,7 +396,8 @@ row_merge_buf_add( field->type.mtype = ifield->col->mtype; field->type.prtype = ifield->col->prtype; - field->type.mbminmaxlen = DATA_MBMINMAXLEN(0, 0); + field->type.mbminlen = 0; + field->type.mbmaxlen = 0; field->type.len = ifield->col->len; } else { row_field = dtuple_get_nth_field(row, col_no); @@ -531,7 +532,7 @@ row_merge_buf_add( if (ifield->prefix_len) { len = dtype_get_at_most_n_mbchars( col->prtype, - col->mbminmaxlen, + col->mbminlen, col->mbmaxlen, ifield->prefix_len, len, static_cast(dfield_get_data(field))); @@ -546,8 +547,7 @@ row_merge_buf_add( fixed_len = ifield->fixed_len; if (fixed_len && !dict_table_is_comp(index->table) - && DATA_MBMINLEN(col->mbminmaxlen) - != DATA_MBMAXLEN(col->mbminmaxlen)) { + && col->mbminlen != col->mbmaxlen) { /* CHAR in ROW_FORMAT=REDUNDANT is always fixed-length, but in the temporary file it is variable-length for variable-length character @@ -557,14 +557,11 @@ row_merge_buf_add( if (fixed_len) { #ifdef UNIV_DEBUG - ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen); - ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen); - /* len should be between size calcualted base on mbmaxlen and mbminlen */ ut_ad(len <= fixed_len); - ut_ad(!mbmaxlen || len >= mbminlen - * (fixed_len / mbmaxlen)); + ut_ad(!col->mbmaxlen || len >= col->mbminlen + * (fixed_len / col->mbmaxlen)); ut_ad(!dfield_is_ext(field)); #endif /* UNIV_DEBUG */ @@ -2626,7 +2623,7 @@ row_merge_copy_blobs( BLOB pointers are read (row_merge_read_clustered_index()) and dereferenced (below). */ data = btr_rec_copy_externally_stored_field( - mrec, offsets, zip_size, i, &len, heap, NULL); + mrec, offsets, zip_size, i, &len, heap); /* Because we have locked the table, any records written by incomplete transactions must have been rolled back already. There must not be any incomplete diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 43f4d4bcdd3c68369a0cb5e85cb05f12df7035dd..549a19799b33ec9501145b8119bedc2ab4ebf614 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2015, 2018, 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 @@ -58,6 +58,7 @@ Created 9/17/2000 Heikki Tuuri #include "btr0sea.h" #include "btr0defragment.h" #include "fil0fil.h" +#include "srv0srv.h" #include "fil0crypt.h" #include "ibuf0ibuf.h" #include "fts0fts.h" @@ -1998,7 +1999,7 @@ row_unlock_for_mysql( trx_id_t rec_trx_id; mtr_t mtr; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Restore the cursor position and find the record */ @@ -2888,7 +2889,7 @@ row_add_table_to_background_drop_list(table_id_t table_id) /*********************************************************************//** Reassigns the table identifier of a table. @return error code or DB_SUCCESS */ -UNIV_INTERN +static dberr_t row_mysql_table_id_reassign( /*========================*/ @@ -3585,7 +3586,7 @@ row_truncate_table_for_mysql( index = dict_table_get_next_index(index); } while (index); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); fsp_header_init(space_id, FIL_IBD_FILE_INITIAL_SIZE, &mtr); mtr_commit(&mtr); @@ -3614,7 +3615,7 @@ row_truncate_table_for_mysql( sys_index = dict_table_get_first_index(dict_sys->sys_indexes); dict_index_copy_types(tuple, sys_index, 1); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF, &pcur, &mtr); for (;;) { @@ -3661,7 +3662,7 @@ row_truncate_table_for_mysql( a page in this mini-transaction, and the rest of this loop could latch another index page. */ mtr_commit(&mtr); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr); } @@ -4003,6 +4004,16 @@ row_drop_table_for_mysql( ut_ad(!table->fts->add_wq); ut_ad(lock_trx_has_sys_table_locks(trx) == 0); + for (;;) { + bool retry = false; + if (dict_fts_index_syncing(table)) { + retry = true; + } + if (!retry) { + break; + } + DICT_BG_YIELD(trx); + } row_mysql_unlock_data_dictionary(trx); fts_optimize_remove_table(table); row_mysql_lock_data_dictionary(trx); diff --git a/storage/xtradb/row/row0purge.cc b/storage/xtradb/row/row0purge.cc index 333677edf21063f643805f672147d18e302607c6..0cd0941987d06e23cf72b4c26352a8dfaefe3215 100644 --- a/storage/xtradb/row/row0purge.cc +++ b/storage/xtradb/row/row0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -823,7 +823,7 @@ row_purge_parse_undo_rec( if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { ptr = trx_undo_rec_get_partial_row( - ptr, clust_index, &node->row, + ptr, clust_index, node->update, &node->row, type == TRX_UNDO_UPD_DEL_REC, node->heap); } diff --git a/storage/xtradb/row/row0quiesce.cc b/storage/xtradb/row/row0quiesce.cc index 6c4e6adb96ce6e655bbbf2972b9b6d726ac166b5..53b4040f74e8a21b7236e45bad3449103ca47f81 100644 --- a/storage/xtradb/row/row0quiesce.cc +++ b/storage/xtradb/row/row0quiesce.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -237,7 +237,11 @@ row_quiesce_write_table( mach_write_to_4(ptr, col->len); ptr += sizeof(ib_uint32_t); - mach_write_to_4(ptr, col->mbminmaxlen); + /* FIXME: This will not work if mbminlen>4. + This field is also redundant, because the lengths + are a property of the character set encoding, which + in turn is encodedin prtype above. */ + mach_write_to_4(ptr, col->mbmaxlen * 5 + col->mbminlen); ptr += sizeof(ib_uint32_t); mach_write_to_4(ptr, col->ind); diff --git a/storage/xtradb/row/row0row.cc b/storage/xtradb/row/row0row.cc index 96d25e15777dbcb848c64c224857f5f1d6175446..9bf9e7182ca670118405508a974def4ec80487a7 100644 --- a/storage/xtradb/row/row0row.cc +++ b/storage/xtradb/row/row0row.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -173,7 +174,7 @@ row_build_index_entry_low( /* If a column prefix index, take only the prefix. */ if (ind_field->prefix_len) { len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, col->mbminlen, col->mbmaxlen, ind_field->prefix_len, len, static_cast(dfield_get_data(dfield))); dfield_set_len(dfield, len); @@ -588,7 +589,8 @@ row_build_row_ref( dfield_set_len(dfield, dtype_get_at_most_n_mbchars( dtype->prtype, - dtype->mbminmaxlen, + dtype->mbminlen, + dtype->mbmaxlen, clust_col_prefix_len, len, (char*) field)); } @@ -702,7 +704,8 @@ row_build_row_ref_in_tuple( dfield_set_len(dfield, dtype_get_at_most_n_mbchars( dtype->prtype, - dtype->mbminmaxlen, + dtype->mbminlen, + dtype->mbmaxlen, clust_col_prefix_len, len, (char*) field)); } diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index 6131129d0a6f9a53bf1161352e7e54e7493e4f7d..03ae6822fb7a16dd801518ae28897f0e1fec07ab 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -98,8 +98,10 @@ row_sel_sec_rec_is_for_blob( /*========================*/ ulint mtype, /*!< in: main type */ ulint prtype, /*!< in: precise type */ - ulint mbminmaxlen, /*!< in: minimum and maximum length of - a multi-byte character */ + ulint mbminlen, /*!< in: minimum length of + a character, in bytes */ + ulint mbmaxlen, /*!< in: maximum length of + a character, in bytes */ const byte* clust_field, /*!< in: the locally stored part of the clustered index column, including the BLOB pointer; the clustered @@ -138,8 +140,7 @@ row_sel_sec_rec_is_for_blob( len = btr_copy_externally_stored_field_prefix(buf, prefix_len, zip_size, - clust_field, clust_len, - NULL); + clust_field, clust_len); if (UNIV_UNLIKELY(len == 0)) { /* The BLOB was being deleted as the server crashed. @@ -150,7 +151,7 @@ row_sel_sec_rec_is_for_blob( return(FALSE); } - len = dtype_get_at_most_n_mbchars(prtype, mbminmaxlen, + len = dtype_get_at_most_n_mbchars(prtype, mbminlen, mbmaxlen, prefix_len, len, (const char*) buf); return(!cmp_data_data(mtype, prtype, buf, len, sec_field, sec_len)); @@ -234,14 +235,14 @@ row_sel_sec_rec_is_for_clust_rec( } len = dtype_get_at_most_n_mbchars( - col->prtype, col->mbminmaxlen, + col->prtype, col->mbminlen, col->mbmaxlen, ifield->prefix_len, len, (char*) clust_field); if (rec_offs_nth_extern(clust_offs, clust_pos) && len < sec_len) { if (!row_sel_sec_rec_is_for_blob( col->mtype, col->prtype, - col->mbminmaxlen, + col->mbminlen, col->mbmaxlen, clust_field, clust_len, sec_field, sec_len, ifield->prefix_len, @@ -458,7 +459,7 @@ row_sel_fetch_columns( data = btr_rec_copy_externally_stored_field( rec, offsets, dict_table_zip_size(index->table), - field_no, &len, heap, NULL); + field_no, &len, heap); /* data == NULL means that the externally stored field was not @@ -1406,7 +1407,7 @@ row_sel( /* Open a cursor to index, or restore an open cursor position */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (consistent_read && plan->unique_search && !plan->pcur_is_open && !plan->must_get_clust @@ -1447,7 +1448,7 @@ row_sel( plan_reset_cursor(plan); mtr_commit(&mtr); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); } if (search_latch_locked) { @@ -2828,7 +2829,7 @@ row_sel_store_mysql_field_func( data = btr_rec_copy_externally_stored_field( rec, offsets, dict_table_zip_size(prebuilt->table), - field_no, &len, heap, NULL); + field_no, &len, heap); if (UNIV_UNLIKELY(!data)) { /* The externally stored field was not written @@ -3933,7 +3934,7 @@ row_search_for_mysql( } } - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /*-------------------------------------------------------------*/ /* PHASE 2: Try fast adaptive hash index search if possible */ @@ -5159,7 +5160,7 @@ row_search_for_mysql( mtr_commit(&mtr); mtr_has_extra_clust_latch = FALSE; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); if (sel_restore_position_for_mysql(&same_user_rec, BTR_SEARCH_LEAF, pcur, moves_up, &mtr)) { @@ -5226,7 +5227,7 @@ row_search_for_mysql( /* It was a lock wait, and it ended */ thr->lock_state = QUE_THR_LOCK_NOLOCK; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* Table lock waited, go try to obtain table lock again */ diff --git a/storage/xtradb/row/row0umod.cc b/storage/xtradb/row/row0umod.cc index 2e5cc14bfe1932a493353a171cf4d1b651c20dd2..bb2fc53661621dc0c7284536b7a8fda493fbe985 100644 --- a/storage/xtradb/row/row0umod.cc +++ b/storage/xtradb/row/row0umod.cc @@ -269,7 +269,7 @@ row_undo_mod_clust( pcur = &node->pcur; index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur)); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); online = dict_index_is_online_ddl(index); if (online) { @@ -298,7 +298,7 @@ row_undo_mod_clust( /* We may have to modify tree structure: do a pessimistic descent down the index tree */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); err = row_undo_mod_clust_low( node, &offsets, &offsets_heap, @@ -350,7 +350,7 @@ row_undo_mod_clust( if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) { - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); /* It is not necessary to call row_log_table, because the record is delete-marked and would thus @@ -363,7 +363,7 @@ row_undo_mod_clust( /* We may have to modify tree structure: do a pessimistic descent down the index tree */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); err = row_undo_mod_remove_clust_low(node, thr, &mtr, BTR_MODIFY_TREE); @@ -410,7 +410,7 @@ row_undo_mod_del_mark_or_remove_sec_low( enum row_search_result search_result; log_free_check(); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (mode == BTR_MODIFY_TREE && index->space == IBUF_SPACE_ID && !dict_index_is_unique(index)) { @@ -471,7 +471,7 @@ row_undo_mod_del_mark_or_remove_sec_low( which cannot be purged yet, requires its existence. If some requires, we should delete mark the record. */ - mtr_start_trx(&mtr_vers, thr_get_trx(thr)); + mtr_start(&mtr_vers); success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur), &mtr_vers); @@ -587,7 +587,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( ut_ad(trx->id); log_free_check(); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); if (mode == BTR_MODIFY_TREE && index->space == IBUF_SPACE_ID && !dict_index_is_unique(index)) { diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc index 113d2f10fc2b371aba4fed3c613fdc291276bc3d..9ac72f8d0685074f4a50d45a0b0e32a1eda9684e 100644 --- a/storage/xtradb/row/row0upd.cc +++ b/storage/xtradb/row/row0upd.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2018, 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 @@ -261,7 +262,7 @@ row_upd_check_references_constraints( DEBUG_SYNC_C("foreign_constraint_check_for_update"); - mtr_start_trx(mtr, trx); + mtr_start(mtr); if (trx->dict_operation_lock_mode == 0) { got_s_lock = TRUE; @@ -1155,7 +1156,7 @@ row_upd_ext_fetch( byte* buf = static_cast(mem_heap_alloc(heap, *len)); *len = btr_copy_externally_stored_field_prefix( - buf, *len, zip_size, data, local_len, NULL); + buf, *len, zip_size, data, local_len); /* We should never update records containing a half-deleted BLOB. */ ut_a(*len); @@ -1207,7 +1208,7 @@ row_upd_index_replace_new_col_val( } len = dtype_get_at_most_n_mbchars(col->prtype, - col->mbminmaxlen, + col->mbminlen, col->mbmaxlen, field->prefix_len, len, (const char*) data); @@ -1855,7 +1856,7 @@ row_upd_sec_index_entry( } #endif /* UNIV_DEBUG */ - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); if (*index->name == TEMP_INDEX_PREFIX) { /* The index->online_status may change if the @@ -2398,7 +2399,7 @@ row_upd_clust_rec( /* We may have to modify the tree structure: do a pessimistic descent down the index tree */ - mtr_start_trx(mtr, thr_get_trx(thr)); + mtr_start(mtr); /* NOTE: this transaction has an s-lock or x-lock on the record and therefore other transactions cannot modify the record when we have no @@ -2613,7 +2614,7 @@ row_upd_clust_step( /* We have to restore the cursor to its position */ - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); /* If the restoration does not succeed, then the same transaction has deleted the record on which the cursor was, @@ -2686,7 +2687,7 @@ row_upd_clust_step( mtr_commit(&mtr); - mtr_start_trx(&mtr, thr_get_trx(thr)); + mtr_start(&mtr); success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, &mtr); diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 65a15b15aecd100899267e88fe4a4b1615f4a0b0..02314db6b07dabaf164869006bea4c89af2d5f38 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -82,10 +82,6 @@ Created 10/8/1995 Heikki Tuuri /* prototypes for new functions added to ha_innodb.cc */ ibool innobase_get_slow_log(); -#ifdef WITH_WSREP -extern int wsrep_debug; -extern int wsrep_trx_is_aborting(void *thd_ptr); -#endif /* The following counter is incremented whenever there is some user activity in the server */ UNIV_INTERN ulint srv_activity_count = 0; @@ -479,6 +475,9 @@ UNIV_INTERN my_bool srv_print_all_deadlocks = FALSE; /* Produce a stacktrace on long semaphore wait */ UNIV_INTERN my_bool srv_use_stacktrace = FALSE; +/** Print lock wait timeout info to mysqld stderr */ +my_bool srv_print_lock_wait_timeout_info = FALSE; + /** Enable INFORMATION_SCHEMA.innodb_cmp_per_index */ UNIV_INTERN my_bool srv_cmp_per_index_enabled = FALSE; @@ -2137,6 +2136,9 @@ srv_export_innodb_status(void) scrub_stat.page_split_failures_unknown; } + export_vars.innodb_buffered_aio_submitted = + srv_stats.n_aio_submitted; + mutex_exit(&srv_innodb_monitor_mutex); } diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc index ff82bb2ad4ec9e1f9e087f8c898b31cef9d0ec03..cbf783628f9d40e4ad8925adde6c207fd7bdf587 100644 --- a/storage/xtradb/trx/trx0purge.cc +++ b/storage/xtradb/trx/trx0purge.cc @@ -584,32 +584,6 @@ trx_purge_rseg_get_next_history_log( mutex_exit(&(rseg->mutex)); mtr_commit(&mtr); - - mutex_enter(&trx_sys->mutex); - - /* Add debug code to track history list corruption reported - on the MySQL mailing list on Nov 9, 2004. The fut0lst.cc - file-based list was corrupt. The prev node pointer was - FIL_NULL, even though the list length was over 8 million nodes! - We assume that purge truncates the history list in large - size pieces, and if we here reach the head of the list, the - list cannot be longer than 2000 000 undo logs now. */ - - if (trx_sys->rseg_history_len > 2000000) { - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Warning: purge reached the" - " head of the history list,\n" - "InnoDB: but its length is still" - " reported as %lu! Make a detailed bug\n" - "InnoDB: report, and submit it" - " to https://jira.mariadb.org/\n", - (ulong) trx_sys->rseg_history_len); - ut_ad(0); - } - - mutex_exit(&trx_sys->mutex); - return; } diff --git a/storage/xtradb/trx/trx0rec.cc b/storage/xtradb/trx/trx0rec.cc index 8cd51c8066be6d41492a7a699848a55fead0d13a..dc9b08299255244321dd80bd5966d012d4ceed5a 100644 --- a/storage/xtradb/trx/trx0rec.cc +++ b/storage/xtradb/trx/trx0rec.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -467,7 +467,7 @@ trx_undo_page_fetch_ext( { /* Fetch the BLOB. */ ulint ext_len = btr_copy_externally_stored_field_prefix( - ext_buf, prefix_len, zip_size, field, *len, NULL); + ext_buf, prefix_len, zip_size, field, *len); /* BLOBs should always be nonempty. */ ut_a(ext_len); /* Append the BLOB pointer to the prefix. */ @@ -1076,6 +1076,7 @@ trx_undo_rec_get_partial_row( used, as we do NOT copy the data in the record! */ dict_index_t* index, /*!< in: clustered index */ + const upd_t* update, /*!< in: updated columns */ dtuple_t** row, /*!< out, own: partial row */ ibool ignore_prefix, /*!< in: flag to indicate if we expect blob prefixes in undo. Used @@ -1103,6 +1104,13 @@ trx_undo_rec_get_partial_row( ->mtype = DATA_MISSING; } + for (const upd_field_t* uf = update->fields, * const ue + = update->fields + update->n_fields; + uf != ue; uf++) { + ulint c = dict_index_get_nth_col(index, uf->field_no)->ind; + *dtuple_get_nth_field(*row, c) = uf->new_val; + } + end_ptr = ptr + mach_read_from_2(ptr); ptr += 2; @@ -1123,6 +1131,10 @@ trx_undo_rec_get_partial_row( ptr = trx_undo_rec_get_col_val(ptr, &field, &len, &orig_len); dfield = dtuple_get_nth_field(*row, col_no); + ut_ad(dfield->type.mtype == DATA_MISSING + || dict_col_type_assert_equal(col, &dfield->type)); + ut_ad(dfield->type.mtype == DATA_MISSING + || dfield->len == len); dict_col_copy_type( dict_table_get_nth_col(index->table, col_no), dfield_get_type(dfield)); @@ -1256,7 +1268,7 @@ trx_undo_report_row_operation( rseg = trx->rseg; - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); mutex_enter(&trx->undo_mutex); /* If the undo log is not assigned yet, assign one */ @@ -1333,7 +1345,7 @@ trx_undo_report_row_operation( latches, such as SYNC_FSP and SYNC_FSP_PAGE. */ mtr_commit(&mtr); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); mutex_enter(&rseg->mutex); trx_undo_free_last_page(trx, undo, &mtr); @@ -1370,7 +1382,7 @@ trx_undo_report_row_operation( /* We have to extend the undo log by one page */ ut_ad(++loop_count < 2); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); /* When we add a page to an undo log, this is analogous to a pessimistic insert in a B-tree, and we must reserve the diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index 9a5fcea71deed188b732dc3c58c12669a6e9b15a..1075064a2d6e4c00b342cbd0092fbcb29f20a37e 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2018, 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 @@ -751,7 +751,8 @@ trx_roll_must_shutdown() mutex_enter(&recv_sys->mutex); if (recv_sys->report(time)) { - ulint n_trx = 0, n_rows = 0; + ulint n_trx = 0; + ulonglong n_rows = 0; for (const trx_t* t = UT_LIST_GET_FIRST(trx_sys->rw_trx_list); t != NULL; t = UT_LIST_GET_NEXT(trx_list, t)) { @@ -765,9 +766,9 @@ trx_roll_must_shutdown() } ib_logf(IB_LOG_LEVEL_INFO, "To roll back: " ULINTPF " transactions, " - ULINTPF " rows", n_trx, n_rows); + "%llu rows", n_trx, n_rows); sd_notifyf(0, "STATUS=To roll back: " ULINTPF " transactions, " - ULINTPF " rows", n_trx, n_rows); + "%llu rows", n_trx, n_rows); } mutex_exit(&recv_sys->mutex); diff --git a/storage/xtradb/trx/trx0undo.cc b/storage/xtradb/trx/trx0undo.cc index 24d14e060806b52c15e8a601b25e4dde504bf2a5..0d5a0f55f0dcd6b1742fb7538febaa64d80528a3 100644 --- a/storage/xtradb/trx/trx0undo.cc +++ b/storage/xtradb/trx/trx0undo.cc @@ -1070,9 +1070,11 @@ Truncates an undo log from the end. This function is used during a rollback to free space from an undo log. */ UNIV_INTERN void -trx_undo_truncate_end( +trx_undo_truncate_end_func( /*=======================*/ - trx_t* trx, /*!< in: transaction whose undo log it is */ +#ifdef UNIV_DEBUG + const trx_t* trx, /*!< in: transaction whose undo log it is */ +#endif /* UNIV_DEBUG */ trx_undo_t* undo, /*!< in: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ @@ -1087,7 +1089,7 @@ trx_undo_truncate_end( ut_ad(mutex_own(&(trx->rseg->mutex))); for (;;) { - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); trunc_here = NULL; @@ -1774,7 +1776,7 @@ trx_undo_assign_undo( ut_ad(mutex_own(&(trx->undo_mutex))); - mtr_start_trx(&mtr, trx); + mtr_start(&mtr); mutex_enter(&rseg->mutex); diff --git a/strings/CMakeLists.txt b/strings/CMakeLists.txt index 65eeb457f2db1154f6f7918f5700f9be2e5f8f74..2a7f0b71cc8d3541236237a68386a00d98c67605 100644 --- a/strings/CMakeLists.txt +++ b/strings/CMakeLists.txt @@ -34,4 +34,5 @@ ADD_DEFINITIONS(-DDISABLE_MYSQL_THREAD_H) ADD_CONVENIENCE_LIBRARY(strings ${STRINGS_SOURCES}) ADD_EXECUTABLE(conf_to_src EXCLUDE_FROM_ALL conf_to_src.c) -TARGET_LINK_LIBRARIES(conf_to_src strings) +SET_TARGET_PROPERTIES(conf_to_src PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE) +TARGET_LINK_LIBRARIES(conf_to_src mysys strings) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index fe00f160d28254f1bd8a036f692520052dd47536..ef9fa5c2a22d3ac69d10ee256421ec55e6bcb631 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -87,7 +87,6 @@ ExecStart=@sbindir@/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITI # Unset _WSREP_START_POSITION environment variable. ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" -KillMode=process KillSignal=SIGTERM # Don't want to see an automated SIGKILL ever diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 000724d7fe22eeef4eb353fa191e6673a0ba3750..465a0d94c628be0373338def4596b1e4070d3a25 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -108,7 +108,6 @@ ExecStart=@sbindir@/mysqld --defaults-file=@sysconf2dir@/my%I.cnf \ # Unset _WSREP_START_POSITION environment variable. ExecStartPost=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" -KillMode=process KillSignal=SIGTERM # Don't want to see an automated SIGKILL ever diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh index ed0da3ccddbc0846cf1314998107421d6c5a8121..c9ea270a78154ff9f73876241c99413a76e8d831 100644 --- a/support-files/mysql.server.sh +++ b/support-files/mysql.server.sh @@ -2,7 +2,7 @@ # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB # This file is public domain and comes with NO WARRANTY of any kind -# MySQL daemon start/stop script. +# MariaDB daemon start/stop script. # Usually this is put in /etc/init.d (at least on machines SYSV R4 based # systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql. @@ -21,14 +21,14 @@ # Required-Stop: $local_fs $network $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: start and stop MySQL -# Description: MySQL is a very fast and reliable SQL database engine. +# Short-Description: start and stop MariaDB +# Description: MariaDB is a very fast and reliable SQL database engine. ### END INIT INFO -# If you install MySQL on some other places than @prefix@, then you +# If you install MariaDB on some other places than @prefix@, then you # have to do one of the following things for this script to work: # -# - Run this script from within the MySQL installation directory +# - Run this script from within the MariaDB installation directory # - Create a /etc/my.cnf file with the following information: # [mysqld] # basedir= @@ -37,11 +37,11 @@ # - Add the path to the mysql-installation-directory to the basedir variable # below. # -# If you want to affect other MySQL variables, you should make your changes -# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. +# If you want to affect other MariaDB variables, you should make your changes +# in the /etc/my.cnf, ~/.my.cnf or other MariaDB configuration files. # If you change base dir, you must also change datadir. These may get -# overwritten by settings in the MySQL configuration files. +# overwritten by settings in the MariaDB configuration files. basedir= datadir= @@ -291,7 +291,7 @@ case "$mode" in # Safeguard (relative paths, core dumps..) cd $basedir - echo $echo_n "Starting MySQL" + echo $echo_n "Starting MariaDB" if test -x $bindir/mysqld_safe then # Give extra arguments to mysqld with the my.cnf file. This script @@ -307,7 +307,7 @@ case "$mode" in exit $return_value else - log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)" + log_failure_msg "Couldn't find MariaDB server ($bindir/mysqld_safe)" fi ;; @@ -321,12 +321,12 @@ case "$mode" in if (kill -0 $mysqld_pid 2>/dev/null) then - echo $echo_n "Shutting down MySQL" + echo $echo_n "Shutting down MariaDB" kill $mysqld_pid # mysqld should remove the pid file when it exits, so wait for it. wait_for_gone $mysqld_pid "$mysqld_pid_file_path"; return_value=$? else - log_failure_msg "MySQL server process #$mysqld_pid is not running!" + log_failure_msg "MariaDB server process #$mysqld_pid is not running!" rm "$mysqld_pid_file_path" fi @@ -337,7 +337,7 @@ case "$mode" in fi exit $return_value else - log_failure_msg "MySQL server PID file could not be found!" + log_failure_msg "MariaDB server PID file could not be found!" fi ;; @@ -358,10 +358,10 @@ case "$mode" in 'reload'|'force-reload') if test -s "$mysqld_pid_file_path" ; then read mysqld_pid < "$mysqld_pid_file_path" - kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL" + kill -HUP $mysqld_pid && log_success_msg "Reloading service MariaDB" touch "$mysqld_pid_file_path" else - log_failure_msg "MySQL PID file could not be found!" + log_failure_msg "MariaDB PID file could not be found!" exit 1 fi ;; @@ -370,10 +370,10 @@ case "$mode" in if test -s "$mysqld_pid_file_path" ; then read mysqld_pid < "$mysqld_pid_file_path" if kill -0 $mysqld_pid 2>/dev/null ; then - log_success_msg "MySQL running ($mysqld_pid)" + log_success_msg "MariaDB running ($mysqld_pid)" exit 0 else - log_failure_msg "MySQL is not running, but PID file exists" + log_failure_msg "MariaDB is not running, but PID file exists" exit 1 fi else @@ -383,17 +383,17 @@ case "$mode" in # test if multiple pids exist pid_count=`echo $mysqld_pid | wc -w` if test $pid_count -gt 1 ; then - log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)" + log_failure_msg "Multiple MariaDB running but PID file could not be found ($mysqld_pid)" exit 5 elif test -z $mysqld_pid ; then if test -f "$lock_file_path" ; then - log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists" + log_failure_msg "MariaDB is not running, but lock file ($lock_file_path) exists" exit 2 fi - log_failure_msg "MySQL is not running" + log_failure_msg "MariaDB is not running" exit 3 else - log_failure_msg "MySQL is running but PID file could not be found" + log_failure_msg "MariaDB is running but PID file could not be found" exit 4 fi fi @@ -401,7 +401,7 @@ case "$mode" in 'configtest') # Safeguard (relative paths, core dumps..) cd $basedir - echo $echo_n "Testing MySQL configuration syntax" + echo $echo_n "Testing MariaDB configuration syntax" daemon=$bindir/mysqld if test -x $libexecdir/mysqld then @@ -439,7 +439,7 @@ case "$mode" in *) # usage basename=`basename "$0"` - echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MySQL server options ]" + echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MariaDB server options ]" exit 1 ;; esac diff --git a/unittest/mysys/base64-t.c b/unittest/mysys/base64-t.c index 4561606936a9e2986af74b8b458761e61dec42fe..a3a37976da6ba3be6f501006009dde694ee24052 100644 --- a/unittest/mysys/base64-t.c +++ b/unittest/mysys/base64-t.c @@ -90,6 +90,9 @@ main(int argc __attribute__((unused)),char *argv[]) diag("src length: %.8x, dst length: %.8x\n", (uint) src_len, (uint) dst_len); } + free(dst); + free(str); + free(src); } my_end(0); return exit_status(); diff --git a/win/packaging/WixUIBannerBmp.jpg b/win/packaging/WixUIBannerBmp.jpg index a04177bed9da0e5f70573f4a6a4337cb6d40128f..66256b79255d04872a1c1670124ee513402363d6 100644 Binary files a/win/packaging/WixUIBannerBmp.jpg and b/win/packaging/WixUIBannerBmp.jpg differ diff --git a/win/packaging/WixUIDialogBmp.jpg b/win/packaging/WixUIDialogBmp.jpg index 466cdc461c8e1a54e712c476062a83c7c6f5ce93..c6ddf12bd2a20b80cb6c1fd1e7f8c66efde84eed 100644 Binary files a/win/packaging/WixUIDialogBmp.jpg and b/win/packaging/WixUIDialogBmp.jpg differ