diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-03-08 23:47:20 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-03-08 23:47:20 +0400 |
commit | ec8c38a82ec1bb00f681a3f6662bd5c76ebb7c75 (patch) | |
tree | b3a7cc7930787be4474ac8abf1663ae92abacba3 | |
parent | 47b7ffb396bd283bd4196194311ba39ed9692421 (diff) | |
parent | 5da6bd7b959af4a9755556afedde8f34d95c679a (diff) | |
download | mariadb-git-ec8c38a82ec1bb00f681a3f6662bd5c76ebb7c75.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
228 files changed, 2443 insertions, 6236 deletions
diff --git a/.travis.yml b/.travis.yml index 66bc3c51f8f..c2fa7283e9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ cache: env: matrix: + - GCC_VERSION=4.8 - GCC_VERSION=5 - GCC_VERSION=6 addons: diff --git a/client/mysqldump.c b/client/mysqldump.c index c5c94e07e96..a02dbdf3845 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2016, MariaDB + Copyright (c) 2010, 2017, 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 @@ -199,12 +199,12 @@ const char *compatible_mode_names[]= }; #define MASK_ANSI_QUOTES \ (\ - (1<<2) | /* POSTGRESQL */\ - (1<<3) | /* ORACLE */\ - (1<<4) | /* MSSQL */\ - (1<<5) | /* DB2 */\ - (1<<6) | /* MAXDB */\ - (1<<10) /* ANSI */\ + (1U<<2) | /* POSTGRESQL */\ + (1U<<3) | /* ORACLE */\ + (1U<<4) | /* MSSQL */\ + (1U<<5) | /* DB2 */\ + (1U<<6) | /* MAXDB */\ + (1U<<10) /* ANSI */\ ) TYPELIB compatible_mode_typelib= {array_elements(compatible_mode_names) - 1, "", compatible_mode_names, NULL}; @@ -5476,7 +5476,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length, *err_len= var_len; } else - found|= ((longlong) 1 << (find - 1)); + found|= 1UL << (find - 1); if (pos == end) break; start= pos + 1; diff --git a/dbug/dbug.c b/dbug/dbug.c index 048e4803b1a..f51525897e2 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -115,18 +115,18 @@ * (until we add flags to _db_stack_frame_, increasing it by 4 bytes) */ -#define DEBUG_ON (1 << 1) /* Debug enabled */ -#define FILE_ON (1 << 2) /* File name print enabled */ -#define LINE_ON (1 << 3) /* Line number print enabled */ -#define DEPTH_ON (1 << 4) /* Function nest level print enabled */ -#define PROCESS_ON (1 << 5) /* Process name print enabled */ -#define NUMBER_ON (1 << 6) /* Number each line of output */ -#define PID_ON (1 << 8) /* Identify each line with process id */ -#define TIMESTAMP_ON (1 << 9) /* timestamp every line of output */ -#define FLUSH_ON_WRITE (1 << 10) /* Flush on every write */ -#define OPEN_APPEND (1 << 11) /* Open for append */ -#define SANITY_CHECK_ON (1 << 12) /* Check memory on every DBUG_ENTER/RETURN */ -#define TRACE_ON ((uint)1 << 31) /* Trace enabled. MUST be the highest bit!*/ +#define DEBUG_ON (1U << 1) /* Debug enabled */ +#define FILE_ON (1U << 2) /* File name print enabled */ +#define LINE_ON (1U << 3) /* Line number print enabled */ +#define DEPTH_ON (1U << 4) /* Function nest level print enabled */ +#define PROCESS_ON (1U << 5) /* Process name print enabled */ +#define NUMBER_ON (1U << 6) /* Number each line of output */ +#define PID_ON (1U << 8) /* Identify each line with process id */ +#define TIMESTAMP_ON (1U << 9) /* timestamp every line of output */ +#define FLUSH_ON_WRITE (1U << 10) /* Flush on every write */ +#define OPEN_APPEND (1U << 11) /* Open for append */ +#define SANITY_CHECK_ON (1U << 12) /* Check memory on every DBUG_ENTER/RETURN */ +#define TRACE_ON (1U << 31) /* Trace enabled. MUST be the highest bit!*/ #define sf_sanity() (0) #define TRACING (cs->stack->flags & TRACE_ON) diff --git a/debian/rules b/debian/rules index 707857a0bac..f16409b4eb4 100755 --- a/debian/rules +++ b/debian/rules @@ -84,6 +84,10 @@ endif -DCOMPILATION_COMMENT="mariadb.org binary distribution" \ -DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \ -DSYSTEM_TYPE="debian-$(DEB_BUILD_GNU_SYSTEM)" \ + $${MYSQL_BUILD_CXX:+-DCMAKE_CXX_COMPILER=$${MYSQL_BUILD_CXX}} \ + $${MYSQL_BUILD_CC:+-DCMAKE_C_COMPILER=$${MYSQL_BUILD_CC}} \ + $${MYSQL_COMPILER_LAUNCHER:+-DCMAKE_CXX_COMPILER_LAUNCHER=${MYSQL_COMPILER_LAUNCHER}} \ + $${MYSQL_COMPILER_LAUNCHER:+-DCMAKE_C_COMPILER_LAUNCHER=${MYSQL_COMPILER_LAUNCHER}} \ -DCMAKE_SYSTEM_PROCESSOR=$(DEB_BUILD_ARCH) \ -DBUILD_CONFIG=mysql_release \ -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \ diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index cb4d26e70c6..159b63c89d7 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -1,5 +1,6 @@ /* Copyright (c) 2005, 2012, 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 the terms of the GNU General Public License as published by @@ -599,8 +600,8 @@ inline word16 UnalignedGetWordNonTemplate(ByteOrder order, const byte* block, word16*) { return (order == BigEndianOrder) - ? block[1] | (block[0] << 8) - : block[0] | (block[1] << 8); + ? word16(block[1] | (word16(block[0]) << 8)) + : word16(block[0] | (word16(block[1]) << 8)); } inline word32 UnalignedGetWordNonTemplate(ByteOrder order, const byte* block, @@ -625,7 +626,7 @@ inline void UnalignedPutWord(ByteOrder order, byte *block, byte value, block[0] = xorBlock ? (value ^ xorBlock[0]) : value; } -#define GETBYTE(x, y) (unsigned int)byte((x)>>(8*(y))) +#define GETBYTE(x, y) byte((x)>>(8*(y))) inline void UnalignedPutWord(ByteOrder order, byte *block, word16 value, const byte *xorBlock = 0) @@ -827,7 +828,7 @@ word ShiftWordsLeftByBits(word* r, unsigned int n, unsigned int shiftBits) inline -word ShiftWordsRightByBits(word* r, unsigned int n, unsigned int shiftBits) +word ShiftWordsRightByBits(word* r, int n, unsigned int shiftBits) { word u, carry=0; if (shiftBits) diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp index bfe8c6ec5d4..f65bc217947 100644 --- a/extra/yassl/taocrypt/include/modes.hpp +++ b/extra/yassl/taocrypt/include/modes.hpp @@ -1,5 +1,6 @@ /* Copyright (c) 2005, 2012, 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 the terms of the GNU General Public License as published by @@ -57,7 +58,7 @@ class Mode_BASE : public virtual_base { public: enum { MaxBlockSz = 16 }; - explicit Mode_BASE(int sz, CipherDir dir, Mode mode) + explicit Mode_BASE(unsigned sz, CipherDir dir, Mode mode) : blockSz_(sz), reg_(reinterpret_cast<byte*>(r_)), tmp_(reinterpret_cast<byte*>(t_)), dir_(dir), mode_(mode) {} @@ -67,7 +68,7 @@ public: void SetIV(const byte* iv) { memcpy(reg_, iv, blockSz_); } protected: - int blockSz_; + unsigned blockSz_; byte* reg_; byte* tmp_; diff --git a/include/my_base.h b/include/my_base.h index 84b2e28d340..89f5e826fd5 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 1995, 2012 Monty Program Ab + Copyright (c) 1995, 2017, 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 @@ -34,25 +34,25 @@ /* The following is bits in the flag parameter to ha_open() */ -#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */ -#define HA_OPEN_WAIT_IF_LOCKED 1 -#define HA_OPEN_IGNORE_IF_LOCKED 2 -#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */ -#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */ -#define HA_OPEN_ABORT_IF_CRASHED 16 -#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */ -#define HA_OPEN_FROM_SQL_LAYER 64 -#define HA_OPEN_MMAP 128 /* open memory mapped */ -#define HA_OPEN_COPY 256 /* Open copy (for repair) */ +#define HA_OPEN_ABORT_IF_LOCKED 0U /* default */ +#define HA_OPEN_WAIT_IF_LOCKED 1U +#define HA_OPEN_IGNORE_IF_LOCKED 2U +#define HA_OPEN_TMP_TABLE 4U /* Table is a temp table */ +#define HA_OPEN_DELAY_KEY_WRITE 8U /* Don't update index */ +#define HA_OPEN_ABORT_IF_CRASHED 16U +#define HA_OPEN_FOR_REPAIR 32U /* open even if crashed */ +#define HA_OPEN_FROM_SQL_LAYER 64U +#define HA_OPEN_MMAP 128U /* open memory mapped */ +#define HA_OPEN_COPY 256U /* Open copy (for repair) */ /* Internal temp table, used for temporary results */ -#define HA_OPEN_INTERNAL_TABLE 512 -#define HA_OPEN_NO_PSI_CALL 1024 /* Don't call/connect PSI */ -#define HA_OPEN_MERGE_TABLE 2048 +#define HA_OPEN_INTERNAL_TABLE 512U +#define HA_OPEN_NO_PSI_CALL 1024U /* Don't call/connect PSI */ +#define HA_OPEN_MERGE_TABLE 2048U /* Allow opening even if table is incompatible as this is for ALTER TABLE which will fix the table structure. */ -#define HA_OPEN_FOR_ALTER 4096 +#define HA_OPEN_FOR_ALTER 4096U /* The following is parameter to ha_rkey() how to use key */ @@ -248,15 +248,15 @@ enum ha_base_keytype { Note that these can only be up to 16 bits! */ -#define HA_NOSAME 1 /* Set if not dupplicated records */ -#define HA_PACK_KEY 2 /* Pack string key to previous key */ -#define HA_AUTO_KEY 16 -#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */ -#define HA_FULLTEXT 128 /* For full-text search */ -#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */ -#define HA_SPATIAL 1024 /* For spatial search */ -#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ -#define HA_GENERATED_KEY 8192 /* Automaticly generated key */ +#define HA_NOSAME 1U /* Set if not dupplicated records */ +#define HA_PACK_KEY 2U /* Pack string key to previous key */ +#define HA_AUTO_KEY 16U +#define HA_BINARY_PACK_KEY 32U /* Packing of all keys to prev key */ +#define HA_FULLTEXT 128U /* For full-text search */ +#define HA_UNIQUE_CHECK 256U /* Check the key for uniqueness */ +#define HA_SPATIAL 1024U /* For spatial search */ +#define HA_NULL_ARE_EQUAL 2048U /* NULL in key are cmp as equal */ +#define HA_GENERATED_KEY 8192U /* Automaticly generated key */ /* The combination of the above can be used for key type comparison. */ #define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ @@ -303,25 +303,25 @@ enum ha_base_keytype { #define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */ /* optionbits for database */ -#define HA_OPTION_PACK_RECORD 1 -#define HA_OPTION_PACK_KEYS 2 -#define HA_OPTION_COMPRESS_RECORD 4 -#define HA_OPTION_LONG_BLOB_PTR 8 /* new ISAM format */ -#define HA_OPTION_TMP_TABLE 16 -#define HA_OPTION_CHECKSUM 32 -#define HA_OPTION_DELAY_KEY_WRITE 64 -#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */ +#define HA_OPTION_PACK_RECORD 1U +#define HA_OPTION_PACK_KEYS 2U +#define HA_OPTION_COMPRESS_RECORD 4U +#define HA_OPTION_LONG_BLOB_PTR 8U /* new ISAM format */ +#define HA_OPTION_TMP_TABLE 16U +#define HA_OPTION_CHECKSUM 32U +#define HA_OPTION_DELAY_KEY_WRITE 64U +#define HA_OPTION_NO_PACK_KEYS 128U /* Reserved for MySQL */ /* unused 256 */ -#define HA_OPTION_RELIES_ON_SQL_LAYER 512 -#define HA_OPTION_NULL_FIELDS 1024 -#define HA_OPTION_PAGE_CHECKSUM 2048 +#define HA_OPTION_RELIES_ON_SQL_LAYER 512U +#define HA_OPTION_NULL_FIELDS 1024U +#define HA_OPTION_PAGE_CHECKSUM 2048U /* STATS_PERSISTENT=1 has been specified in the SQL command (either CREATE or ALTER TABLE). Table and index statistics that are collected by the storage engine and used by the optimizer for query optimization will be stored on disk and will not change after a server restart. */ -#define HA_OPTION_STATS_PERSISTENT 4096 +#define HA_OPTION_STATS_PERSISTENT 4096U /* STATS_PERSISTENT=0 has been specified in CREATE/ALTER TABLE. Statistics for the table will be wiped away on server shutdown and new ones recalculated @@ -330,31 +330,31 @@ enum ha_base_keytype { explicitly set at table level and the corresponding table will use whatever is the global server default. */ -#define HA_OPTION_NO_STATS_PERSISTENT 8192 +#define HA_OPTION_NO_STATS_PERSISTENT 8192U /* .frm has extra create options in linked-list format */ -#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1L << 14) /* 5.2 to 5.5, unused since 10.0 */ -#define HA_OPTION_TEMP_COMPRESS_RECORD (1L << 15) /* set by isamchk */ -#define HA_OPTION_READ_ONLY_DATA (1L << 16) /* Set by isamchk */ -#define HA_OPTION_NO_CHECKSUM (1L << 17) -#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18) +#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1U << 14) /* 5.2 to 5.5, unused since 10.0 */ +#define HA_OPTION_TEMP_COMPRESS_RECORD (1U << 15) /* set by isamchk */ +#define HA_OPTION_READ_ONLY_DATA (1U << 16) /* Set by isamchk */ +#define HA_OPTION_NO_CHECKSUM (1U << 17) +#define HA_OPTION_NO_DELAY_KEY_WRITE (1U << 18) /* Bits in flag to create() */ -#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */ -#define HA_PACK_RECORD 2 /* Request packed record format */ -#define HA_CREATE_TMP_TABLE 4 -#define HA_CREATE_CHECKSUM 8 -#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */ -#define HA_CREATE_PAGE_CHECKSUM 32 -#define HA_CREATE_DELAY_KEY_WRITE 64 -#define HA_CREATE_RELIES_ON_SQL_LAYER 128 -#define HA_CREATE_INTERNAL_TABLE 256 -#define HA_PRESERVE_INSERT_ORDER 512 +#define HA_DONT_TOUCH_DATA 1U /* Don't empty datafile (isamchk) */ +#define HA_PACK_RECORD 2U /* Request packed record format */ +#define HA_CREATE_TMP_TABLE 4U +#define HA_CREATE_CHECKSUM 8U +#define HA_CREATE_KEEP_FILES 16U /* don't overwrite .MYD and MYI */ +#define HA_CREATE_PAGE_CHECKSUM 32U +#define HA_CREATE_DELAY_KEY_WRITE 64U +#define HA_CREATE_RELIES_ON_SQL_LAYER 128U +#define HA_CREATE_INTERNAL_TABLE 256U +#define HA_PRESERVE_INSERT_ORDER 512U /* Flags used by start_bulk_insert */ -#define HA_CREATE_UNIQUE_INDEX_BY_SORT 1 +#define HA_CREATE_UNIQUE_INDEX_BY_SORT 1U /* @@ -366,44 +366,44 @@ enum ha_base_keytype { */ /* this one is not used */ -#define HA_STATUS_POS 1 +#define HA_STATUS_POS 1U /* assuming the table keeps shared actual copy of the 'info' and local, possibly outdated copy, the following flag means that it should not try to get the actual data (locking the shared structure) slightly outdated version will suffice */ -#define HA_STATUS_NO_LOCK 2 +#define HA_STATUS_NO_LOCK 2U /* update the time of the last modification (in handler::update_time) */ -#define HA_STATUS_TIME 4 +#define HA_STATUS_TIME 4U /* update the 'constant' part of the info: handler::max_data_file_length, max_index_file_length, create_time sortkey, ref_length, block_size, data_file_name, index_file_name. handler::table->s->keys_in_use, keys_for_keyread, rec_per_key */ -#define HA_STATUS_CONST 8 +#define HA_STATUS_CONST 8U /* update the 'variable' part of the info: handler::records, deleted, data_file_length, index_file_length, check_time, mean_rec_length */ -#define HA_STATUS_VARIABLE 16 +#define HA_STATUS_VARIABLE 16U /* get the information about the key that caused last duplicate value error update handler::errkey and handler::dupp_ref see handler::get_dup_key() */ -#define HA_STATUS_ERRKEY 32 +#define HA_STATUS_ERRKEY 32U /* update handler::auto_increment_value */ -#define HA_STATUS_AUTO 64 +#define HA_STATUS_AUTO 64U /* Get also delete_length when HA_STATUS_VARIABLE is called. It's ok to set it also when only HA_STATUS_VARIABLE but it won't be used. */ -#define HA_STATUS_VARIABLE_EXTRA 128 +#define HA_STATUS_VARIABLE_EXTRA 128U /* Errorcodes given by handler functions @@ -521,23 +521,23 @@ typedef ulong key_part_map; /* Intern constants in databases */ /* bits in _search */ -#define SEARCH_FIND 1 -#define SEARCH_NO_FIND 2 -#define SEARCH_SAME 4 -#define SEARCH_BIGGER 8 -#define SEARCH_SMALLER 16 -#define SEARCH_SAVE_BUFF 32 -#define SEARCH_UPDATE 64 -#define SEARCH_PREFIX 128 -#define SEARCH_LAST 256 -#define MBR_CONTAIN 512 -#define MBR_INTERSECT 1024 -#define MBR_WITHIN 2048 -#define MBR_DISJOINT 4096 -#define MBR_EQUAL 8192 -#define MBR_DATA 16384 -#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */ -#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */ +#define SEARCH_FIND 1U +#define SEARCH_NO_FIND 2U +#define SEARCH_SAME 4U +#define SEARCH_BIGGER 8U +#define SEARCH_SMALLER 16U +#define SEARCH_SAVE_BUFF 32U +#define SEARCH_UPDATE 64U +#define SEARCH_PREFIX 128U +#define SEARCH_LAST 256U +#define MBR_CONTAIN 512U +#define MBR_INTERSECT 1024U +#define MBR_WITHIN 2048U +#define MBR_DISJOINT 4096U +#define MBR_EQUAL 8192U +#define MBR_DATA 16384U +#define SEARCH_NULL_ARE_EQUAL 32768U /* NULL in keys are equal */ +#define SEARCH_NULL_ARE_NOT_EQUAL 65536U/* NULL in keys are not equal */ /* Use this when inserting a key in position order */ #define SEARCH_INSERT (SEARCH_NULL_ARE_NOT_EQUAL*2) /* Only part of the key is specified while reading */ @@ -548,27 +548,27 @@ typedef ulong key_part_map; #define SEARCH_PAGE_KEY_HAS_TRANSID (SEARCH_USER_KEY_HAS_TRANSID*2) /* bits in opt_flag */ -#define QUICK_USED 1 -#define READ_CACHE_USED 2 -#define READ_CHECK_USED 4 -#define KEY_READ_USED 8 -#define WRITE_CACHE_USED 16 -#define OPT_NO_ROWS 32 +#define QUICK_USED 1U +#define READ_CACHE_USED 2U +#define READ_CHECK_USED 4U +#define KEY_READ_USED 8U +#define WRITE_CACHE_USED 16U +#define OPT_NO_ROWS 32U /* bits in update */ -#define HA_STATE_CHANGED 1 /* Database has changed */ -#define HA_STATE_AKTIV 2 /* Has a current record */ -#define HA_STATE_WRITTEN 4 /* Record is written */ -#define HA_STATE_DELETED 8 -#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */ -#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */ -#define HA_STATE_NO_KEY 64 /* Last read didn't find record */ -#define HA_STATE_KEY_CHANGED 128 -#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */ -#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ -#define HA_STATE_ROW_CHANGED 1024 /* To invalidate ROW cache */ -#define HA_STATE_EXTEND_BLOCK 2048 -#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */ +#define HA_STATE_CHANGED 1U /* Database has changed */ +#define HA_STATE_AKTIV 2U /* Has a current record */ +#define HA_STATE_WRITTEN 4U /* Record is written */ +#define HA_STATE_DELETED 8U +#define HA_STATE_NEXT_FOUND 16U /* Next found record (record before) */ +#define HA_STATE_PREV_FOUND 32U /* Prev found record (record after) */ +#define HA_STATE_NO_KEY 64U /* Last read didn't find record */ +#define HA_STATE_KEY_CHANGED 128U +#define HA_STATE_WRITE_AT_END 256U /* set in _ps_find_writepos */ +#define HA_STATE_BUFF_SAVED 512U /* If current keybuff is info->buff */ +#define HA_STATE_ROW_CHANGED 1024U /* To invalidate ROW cache */ +#define HA_STATE_EXTEND_BLOCK 2048U +#define HA_STATE_RNEXT_SAME 4096U /* rnext_same occupied lastkey2 */ /* myisampack expects no more than 32 field types. */ enum en_fieldtype { @@ -584,15 +584,15 @@ enum data_file_type { /* For key ranges */ -#define NO_MIN_RANGE 1 -#define NO_MAX_RANGE 2 -#define NEAR_MIN 4 -#define NEAR_MAX 8 -#define UNIQUE_RANGE 16 -#define EQ_RANGE 32 -#define NULL_RANGE 64 -#define GEOM_FLAG 128 -#define SKIP_RANGE 256 +#define NO_MIN_RANGE 1U +#define NO_MAX_RANGE 2U +#define NEAR_MIN 4U +#define NEAR_MAX 8U +#define UNIQUE_RANGE 16U +#define EQ_RANGE 32U +#define NULL_RANGE 64U +#define GEOM_FLAG 128U +#define SKIP_RANGE 256U typedef struct st_key_range { diff --git a/include/my_bit.h b/include/my_bit.h index a50403c312d..e7fd90f7b30 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -1,5 +1,5 @@ /* Copyright (c) 2007, 2011, Oracle and/or its affiliates. - Copyright (c) 2009-2011, Monty Program Ab + Copyright (c) 2009, 2017, 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 @@ -114,7 +114,7 @@ static inline uint32 my_clear_highest_bit(uint32 v) static inline uint32 my_reverse_bits(uint32 key) { - return + return (uint32) (_my_bits_reverse_table[ key & 255] << 24) | (_my_bits_reverse_table[(key>> 8) & 255] << 16) | (_my_bits_reverse_table[(key>>16) & 255] << 8) | diff --git a/include/my_global.h b/include/my_global.h index 4f40d3e0615..e4ca562772e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab. + Copyright (c) 2010, 2017, 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 @@ -677,7 +677,7 @@ typedef SOCKET_SIZE_TYPE size_socket; smaller what the disk page size. This influences the speed of the isam btree library. eg to big to slow. */ -#define IO_SIZE 4096 +#define IO_SIZE 4096U /* How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes diff --git a/include/my_pthread.h b/include/my_pthread.h index bf61a024390..a38636af87d 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, MariaDB + Copyright (c) 2009, 2017, 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 @@ -651,7 +651,7 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr; #define ESRCH 1 #endif -typedef int64 my_thread_id; +typedef uint64 my_thread_id; extern void my_threadattr_global_init(void); extern my_bool my_thread_global_init(void); diff --git a/include/my_sys.h b/include/my_sys.h index 2e24bfd02d3..6834bbd8dc2 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2010, 2016, Monty Program Ab. + Copyright (c) 2010, 2017, 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 @@ -60,75 +60,75 @@ typedef struct my_aio_result { #define MY_FILE_ERROR ((size_t) -1) /* General bitmaps for my_func's */ -#define MY_FFNF 1 /* Fatal if file not found */ -#define MY_FNABP 2 /* Fatal if not all bytes read/writen */ -#define MY_NABP 4 /* Error if not all bytes read/writen */ -#define MY_FAE 8 /* Fatal if any error */ -#define MY_WME 16 /* Write message on error */ -#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */ -#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */ -#define MY_ENCRYPT 64 /* Encrypt IO_CACHE temporary files */ -#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */ -#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */ -#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */ -#define MY_COPYTIME 64 /* my_redel() copys time */ -#define MY_DELETE_OLD 256 /* my_create_with_symlink() */ -#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */ -#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */ -#define MY_REDEL_MAKE_BACKUP 256 -#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */ -#define MY_SHORT_WAIT 64 /* my_lock() don't wait if can't lock */ -#define MY_FORCE_LOCK 128 /* use my_lock() even if disable_locking */ -#define MY_NO_WAIT 256 /* my_lock() don't wait at all */ +#define MY_FFNF 1U /* Fatal if file not found */ +#define MY_FNABP 2U /* Fatal if not all bytes read/writen */ +#define MY_NABP 4U /* Error if not all bytes read/writen */ +#define MY_FAE 8U /* Fatal if any error */ +#define MY_WME 16U /* Write message on error */ +#define MY_WAIT_IF_FULL 32U /* Wait and try again if disk full error */ +#define MY_IGNORE_BADFD 32U /* my_sync: ignore 'bad descriptor' errors */ +#define MY_ENCRYPT 64U /* Encrypt IO_CACHE temporary files */ +#define MY_FULL_IO 512U /* For my_read - loop intil I/O is complete */ +#define MY_DONT_CHECK_FILESIZE 128U /* Option to init_io_cache() */ +#define MY_LINK_WARNING 32U /* my_redel() gives warning if links */ +#define MY_COPYTIME 64U /* my_redel() copys time */ +#define MY_DELETE_OLD 256U /* my_create_with_symlink() */ +#define MY_RESOLVE_LINK 128U /* my_realpath(); Only resolve links */ +#define MY_HOLD_ORIGINAL_MODES 128U /* my_copy() holds to file modes */ +#define MY_REDEL_MAKE_BACKUP 256U +#define MY_SEEK_NOT_DONE 32U /* my_lock may have to do a seek */ +#define MY_SHORT_WAIT 64U /* my_lock() don't wait if can't lock */ +#define MY_FORCE_LOCK 128U /* use my_lock() even if disable_locking */ +#define MY_NO_WAIT 256U /* my_lock() don't wait at all */ /* init_dynamic_array() has init buffer; Internal flag, not to be used by caller. */ -#define MY_INIT_BUFFER_USED 256 -#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */ -#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */ -#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ -#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ -#define MY_DONT_OVERWRITE_FILE 2048 /* my_copy: Don't overwrite file */ -#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ -#define MY_SYNC 4096 /* my_copy(): sync dst file */ -#define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */ -#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */ -#define MY_THREAD_SPECIFIC 0x10000 /* my_malloc(): thread specific */ -#define MY_THREAD_MOVE 0x20000 /* realloc(); Memory can move */ -/* Tree that should delete things automaticly */ -#define MY_TREE_WITH_DELETE 0x40000 - -#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ -#define MY_GIVE_INFO 2 /* Give time info about process*/ -#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ - -#define ME_HIGHBYTE 8 /* Shift for colours */ -#define ME_NOCUR 1 /* Don't use curses message */ -#define ME_OLDWIN 2 /* Use old window */ -#define ME_BELL 4 /* Ring bell then printing message */ -#define ME_HOLDTANG 8 /* Don't delete last keys */ -#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */ -#define ME_WAITTANG 32 /* Wait for a user action */ -#define ME_NOREFRESH 64 /* Write the error message to error log */ -#define ME_NOINPUT 128 /* Dont use the input libary */ -#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */ -#define ME_COLOUR2 ((2 << ME_HIGHBYTE)) -#define ME_COLOUR3 ((3 << ME_HIGHBYTE)) -#define ME_JUST_INFO 1024 /**< not error but just info */ -#define ME_JUST_WARNING 2048 /**< not error but just warning */ -#define ME_FATALERROR 4096 /* Fatal statement error */ +#define MY_INIT_BUFFER_USED 256U +#define MY_ZEROFILL 32U /* my_malloc(), fill array with zero */ +#define MY_ALLOW_ZERO_PTR 64U /* my_realloc() ; zero ptr -> malloc */ +#define MY_FREE_ON_ERROR 128U /* my_realloc() ; Free old ptr on error */ +#define MY_HOLD_ON_ERROR 256U /* my_realloc() ; Return old ptr on error */ +#define MY_DONT_OVERWRITE_FILE 2048U /* my_copy: Don't overwrite file */ +#define MY_THREADSAFE 2048U /* my_seek(): lock fd mutex */ +#define MY_SYNC 4096U /* my_copy(): sync dst file */ +#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */ +#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */ +#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */ +#define MY_THREAD_MOVE 0x20000U /* realloc(); Memory can move */ +/* Tree that should delete things automaticly */ +#define MY_TREE_WITH_DELETE 0x40000U + +#define MY_CHECK_ERROR 1U /* Params to my_end; Check open-close */ +#define MY_GIVE_INFO 2U /* Give time info about process*/ +#define MY_DONT_FREE_DBUG 4U /* Do not call DBUG_END() in my_end() */ + +#define ME_HIGHBYTE 8U /* Shift for colours */ +#define ME_NOCUR 1U /* Don't use curses message */ +#define ME_OLDWIN 2U /* Use old window */ +#define ME_BELL 4U /* Ring bell then printing message */ +#define ME_HOLDTANG 8U /* Don't delete last keys */ +#define ME_WAITTOT 16U /* Wait for errtime secs of for a action */ +#define ME_WAITTANG 32U /* Wait for a user action */ +#define ME_NOREFRESH 64U /* Write the error message to error log */ +#define ME_NOINPUT 128U /* Dont use the input libary */ +#define ME_COLOUR1 ((1U << ME_HIGHBYTE)) /* Possibly error-colours */ +#define ME_COLOUR2 ((2U << ME_HIGHBYTE)) +#define ME_COLOUR3 ((3U << ME_HIGHBYTE)) +#define ME_JUST_INFO 1024U /**< not error but just info */ +#define ME_JUST_WARNING 2048U /**< not error but just warning */ +#define ME_FATALERROR 4096U /* Fatal statement error */ /* Bits in last argument to fn_format */ -#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ -#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */ -#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */ -#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */ -#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */ -#define MY_RETURN_REAL_PATH 32 /* return full path for file */ -#define MY_SAFE_PATH 64 /* Return NULL if too long path */ -#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */ -#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/ +#define MY_REPLACE_DIR 1U /* replace dir in name with 'dir' */ +#define MY_REPLACE_EXT 2U /* replace extension with 'ext' */ +#define MY_UNPACK_FILENAME 4U /* Unpack name (~ -> home) */ +#define MY_PACK_FILENAME 8U /* Pack name (home -> ~) */ +#define MY_RESOLVE_SYMLINKS 16U /* Resolve all symbolic links */ +#define MY_RETURN_REAL_PATH 32U /* return full path for file */ +#define MY_SAFE_PATH 64U /* Return NULL if too long path */ +#define MY_RELATIVE_PATH 128U /* name is relative to 'dir' */ +#define MY_APPEND_EXT 256U /* add 'ext' as additional extension*/ /* My seek flags */ @@ -143,19 +143,19 @@ typedef struct my_aio_result { #define DFLT_INIT_HITS 3 /* root_alloc flags */ -#define MY_KEEP_PREALLOC 1 -#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */ +#define MY_KEEP_PREALLOC 1U +#define MY_MARK_BLOCKS_FREE 2U /* move used to free list and reuse them */ /* Internal error numbers (for assembler functions) */ #define MY_ERRNO_EDOM 33 #define MY_ERRNO_ERANGE 34 /* Bits for get_date timeflag */ -#define GETDATE_DATE_TIME 1 -#define GETDATE_SHORT_DATE 2 -#define GETDATE_HHMMSSTIME 4 -#define GETDATE_GMT 8 -#define GETDATE_FIXEDLENGTH 16 +#define GETDATE_DATE_TIME 1U +#define GETDATE_SHORT_DATE 2U +#define GETDATE_HHMMSSTIME 4U +#define GETDATE_GMT 8U +#define GETDATE_FIXEDLENGTH 16U /* Extra length needed for filename if one calls my_create_backup_name */ #define MY_BACKUP_NAME_EXTRA_LENGTH 17 diff --git a/include/my_time.h b/include/my_time.h index 8dc1f09ba0f..90d19c8861a 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -1,5 +1,6 @@ /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. + Copyright (c) 2017, Monty Program Ab. 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 @@ -61,16 +62,16 @@ extern uchar days_in_month[]; TIME_FUZZY_DATES is used for the result will only be used for comparison purposes. Conversion is as relaxed as possible. */ -#define TIME_FUZZY_DATES 1 -#define TIME_DATETIME_ONLY 2 -#define TIME_TIME_ONLY 4 +#define TIME_FUZZY_DATES 1U +#define TIME_DATETIME_ONLY 2U +#define TIME_TIME_ONLY 4U #define TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */ #define TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */ #define TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */ -#define MYSQL_TIME_WARN_TRUNCATED 1 -#define MYSQL_TIME_WARN_OUT_OF_RANGE 2 -#define MYSQL_TIME_NOTE_TRUNCATED 16 +#define MYSQL_TIME_WARN_TRUNCATED 1U +#define MYSQL_TIME_WARN_OUT_OF_RANGE 2U +#define MYSQL_TIME_NOTE_TRUNCATED 16U #define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE) #define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) diff --git a/include/my_valgrind.h b/include/my_valgrind.h index 9ceb49c1094..3519d7bb757 100644 --- a/include/my_valgrind.h +++ b/include/my_valgrind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Monty Program Ab +/* Copyright (C) 2010, 2017, 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 @@ -38,7 +38,7 @@ #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) #endif #define TRASH_ALLOC(A,B) TRASH_FILL(A,B,0xA5) -#define TRASH_FREE(A,B) TRASH_FILL(A,B,0x8F) +#define TRASH_FREE(A,B) TRASH_FILL(A,(size_t) (B),0x8F) #define TRASH(A,B) TRASH_FREE(A,B) # define DBUG_ASSERT_DEFINED(x) \ diff --git a/include/myisamchk.h b/include/myisamchk.h index 643241d84e5..40aa0b19d49 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -1,4 +1,5 @@ /* Copyright (C) 2006 MySQL AB + Copyright (c) 2017, 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 @@ -24,13 +25,13 @@ to xxxcheck.c follows: */ -#define TT_USEFRM 1 -#define TT_FOR_UPGRADE 2 -#define TT_FROM_MYSQL 4 +#define TT_USEFRM 1U +#define TT_FOR_UPGRADE 2U +#define TT_FROM_MYSQL 4U /* Bits set in out_flag */ -#define O_NEW_DATA 2 -#define O_DATA_LOST 4 +#define O_NEW_DATA 2U +#define O_DATA_LOST 4U typedef struct st_sort_key_blocks /* Used when sorting */ { diff --git a/include/mysql/psi/mysql_idle.h b/include/mysql/psi/mysql_idle.h index 5c72b715b7a..b623edce108 100644 --- a/include/mysql/psi/mysql_idle.h +++ b/include/mysql/psi/mysql_idle.h @@ -1,4 +1,5 @@ /* Copyright (c) 2011, 2012, 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 the terms of the GNU General Public License as published by @@ -67,7 +68,7 @@ */ static inline struct PSI_idle_locker * inline_mysql_start_idle_wait(PSI_idle_locker_state *state, - const char *src_file, int src_line) + const char *src_file, uint src_line) { struct PSI_idle_locker *locker; locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line); diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h index 619f600a776..64531e5c35e 100644 --- a/include/mysql/psi/mysql_socket.h +++ b/include/mysql/psi/mysql_socket.h @@ -1,4 +1,5 @@ /* Copyright (c) 2010, 2012, 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 the terms of the GNU General Public License as @@ -241,7 +242,7 @@ inline_mysql_start_socket_wait(PSI_socket_locker_state *state, MYSQL_SOCKET mysql_socket, enum PSI_socket_operation op, size_t byte_count, - const char *src_file, int src_line) + const char *src_file, uint src_line) { struct PSI_socket_locker *locker; if (mysql_socket.m_psi != NULL) @@ -744,8 +745,7 @@ inline_mysql_socket_send /* Instrumentation end */ if (locker != NULL) { - size_t bytes_written; - bytes_written= (result > -1) ? result : 0; + size_t bytes_written= (result > 0) ? (size_t) result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); } @@ -786,8 +786,7 @@ inline_mysql_socket_recv /* Instrumentation end */ if (locker != NULL) { - size_t bytes_read; - bytes_read= (result > -1) ? result : 0; + size_t bytes_read= (result > 0) ? (size_t) result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); } @@ -828,8 +827,7 @@ inline_mysql_socket_sendto /* Instrumentation end */ if (locker != NULL) { - size_t bytes_written; - bytes_written = (result > -1) ? result : 0; + size_t bytes_written = (result > 0) ? (size_t) result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written); } @@ -871,8 +869,7 @@ inline_mysql_socket_recvfrom /* Instrumentation end */ if (locker != NULL) { - size_t bytes_read; - bytes_read = (result > -1) ? result : 0; + size_t bytes_read= (result > 0) ? (size_t) result : 0; PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read); } diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h index 3d5943fa55a..05016130af7 100644 --- a/include/mysql/psi/mysql_statement.h +++ b/include/mysql/psi/mysql_statement.h @@ -1,4 +1,5 @@ /* Copyright (c) 2010, 2015, 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 the terms of the GNU General Public License as published by @@ -146,7 +147,7 @@ inline_mysql_start_statement(PSI_statement_locker_state *state, PSI_statement_key key, const char *db, uint db_len, const CHARSET_INFO *charset, - const char *src_file, int src_line) + const char *src_file, uint src_line) { PSI_statement_locker *locker; locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset); diff --git a/include/mysql/psi/mysql_table.h b/include/mysql/psi/mysql_table.h index 74217a32b13..5b4b64a8e48 100644 --- a/include/mysql/psi/mysql_table.h +++ b/include/mysql/psi/mysql_table.h @@ -1,4 +1,5 @@ /* Copyright (c) 2010, 2012, 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 the terms of the GNU General Public License as published by @@ -183,7 +184,7 @@ static inline struct PSI_table_locker * inline_mysql_start_table_lock_wait(PSI_table_locker_state *state, struct PSI_table *psi, enum PSI_table_lock_operation op, - ulong flags, const char *src_file, int src_line) + ulong flags, const char *src_file, uint src_line) { if (psi != NULL) { diff --git a/include/mysql_com.h b/include/mysql_com.h index ba389933b15..2cb4656ceef 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab + Copyright (c) 2010, 2017, 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 @@ -25,8 +25,8 @@ #define HOSTNAME_LENGTH 60 #define SYSTEM_CHARSET_MBMAXLEN 3 -#define NAME_CHAR_LEN 64 /* Field/table name length */ -#define USERNAME_CHAR_LENGTH 128 +#define NAME_CHAR_LEN 64U /* Field/table name length */ +#define USERNAME_CHAR_LENGTH 128U #define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN) #define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN) #define DEFINER_CHAR_LENGTH (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 1) @@ -149,40 +149,40 @@ enum enum_indicator_type #define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2) -#define NOT_NULL_FLAG 1 /* Field can't be NULL */ -#define PRI_KEY_FLAG 2 /* Field is part of a primary key */ -#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ -#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ -#define BLOB_FLAG 16 /* Field is a blob */ -#define UNSIGNED_FLAG 32 /* Field is unsigned */ -#define ZEROFILL_FLAG 64 /* Field is zerofill */ -#define BINARY_FLAG 128 /* Field is binary */ +#define NOT_NULL_FLAG 1U /* Field can't be NULL */ +#define PRI_KEY_FLAG 2U /* Field is part of a primary key */ +#define UNIQUE_KEY_FLAG 4U /* Field is part of a unique key */ +#define MULTIPLE_KEY_FLAG 8U /* Field is part of a key */ +#define BLOB_FLAG 16U /* Field is a blob */ +#define UNSIGNED_FLAG 32U /* Field is unsigned */ +#define ZEROFILL_FLAG 64U /* Field is zerofill */ +#define BINARY_FLAG 128U /* Field is binary */ /* The following are only sent to new clients */ -#define ENUM_FLAG 256 /* field is an enum */ -#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ -#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ -#define SET_FLAG 2048 /* field is a set */ -#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */ -#define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */ -#define NUM_FLAG 32768 /* Field is num (for clients) */ -#define PART_KEY_FLAG 16384 /* Intern; Part of some key */ -#define GROUP_FLAG 32768 /* Intern: Group field */ -#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ -#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */ -#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */ +#define ENUM_FLAG 256U /* field is an enum */ +#define AUTO_INCREMENT_FLAG 512U /* field is a autoincrement field */ +#define TIMESTAMP_FLAG 1024U /* Field is a timestamp */ +#define SET_FLAG 2048U /* field is a set */ +#define NO_DEFAULT_VALUE_FLAG 4096U /* Field doesn't have default value */ +#define ON_UPDATE_NOW_FLAG 8192U /* Field is set to NOW on UPDATE */ +#define NUM_FLAG 32768U /* Field is num (for clients) */ +#define PART_KEY_FLAG 16384U /* Intern; Part of some key */ +#define GROUP_FLAG 32768U /* Intern: Group field */ +#define BINCMP_FLAG 131072U /* Intern: Used by sql_yacc */ +#define GET_FIXED_FIELDS_FLAG (1U << 18) /* Used to get fields in item tree */ +#define FIELD_IN_PART_FUNC_FLAG (1U << 19)/* Field part of partition func */ /** Intern: Field in TABLE object for new version of altered table, which participates in a newly added index. */ -#define FIELD_IN_ADD_INDEX (1 << 20) -#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */ +#define FIELD_IN_ADD_INDEX (1U << 20) +#define FIELD_IS_RENAMED (1U << 21) /* Intern: Field is being renamed */ #define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */ -#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA) +#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3U << FIELD_FLAGS_STORAGE_MEDIA) #define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */ -#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT) -#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */ +#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3U << FIELD_FLAGS_COLUMN_FORMAT) +#define FIELD_IS_DROPPED (1U << 26) /* Intern: Field is being dropped */ #define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */ #define REFRESH_LOG (1ULL << 1) /* Start on new log file */ @@ -335,36 +335,36 @@ enum enum_indicator_type implicitly, by the first transactional statement, when autocommit=off. */ -#define SERVER_STATUS_IN_TRANS 1 -#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ -#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ -#define SERVER_QUERY_NO_GOOD_INDEX_USED 16 -#define SERVER_QUERY_NO_INDEX_USED 32 +#define SERVER_STATUS_IN_TRANS 1U +#define SERVER_STATUS_AUTOCOMMIT 2U /* Server in auto_commit mode */ +#define SERVER_MORE_RESULTS_EXISTS 8U /* Multi query - next query exists */ +#define SERVER_QUERY_NO_GOOD_INDEX_USED 16U +#define SERVER_QUERY_NO_INDEX_USED 32U /** The server was able to fulfill the clients request and opened a read-only non-scrollable cursor for a query. This flag comes in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. */ -#define SERVER_STATUS_CURSOR_EXISTS 64 +#define SERVER_STATUS_CURSOR_EXISTS 64U /** This flag is sent when a read-only cursor is exhausted, in reply to COM_STMT_FETCH command. */ -#define SERVER_STATUS_LAST_ROW_SENT 128 -#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ -#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512 +#define SERVER_STATUS_LAST_ROW_SENT 128U +#define SERVER_STATUS_DB_DROPPED 256U /* A database was dropped */ +#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512U /** Sent to the client if after a prepared statement reprepare we discovered that the new statement returns a different number of result set columns. */ -#define SERVER_STATUS_METADATA_CHANGED 1024 -#define SERVER_QUERY_WAS_SLOW 2048 +#define SERVER_STATUS_METADATA_CHANGED 1024U +#define SERVER_QUERY_WAS_SLOW 2048U /** To mark ResultSet containing output parameter values. */ -#define SERVER_PS_OUT_PARAMS 4096 +#define SERVER_PS_OUT_PARAMS 4096U /** Set at the same time as SERVER_STATUS_IN_TRANS if the started @@ -373,7 +373,7 @@ enum enum_indicator_type to clients in OK and EOF packets, the flag indicates the transaction status at the end of command execution. */ -#define SERVER_STATUS_IN_TRANS_READONLY 8192 +#define SERVER_STATUS_IN_TRANS_READONLY 8192U /** This status flag, when on, implies that one of the state information has @@ -455,7 +455,7 @@ typedef struct st_net { } NET; -#define packet_error (~(unsigned long) 0) +#define packet_error ~0UL enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, @@ -706,9 +706,9 @@ void my_thread_end(void); } #endif -#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ -#define MYSQL_STMT_HEADER 4 -#define MYSQL_LONG_DATA_HEADER 6 +#define NULL_LENGTH ~0UL /* For net_store_length */ +#define MYSQL_STMT_HEADER 4U +#define MYSQL_LONG_DATA_HEADER 6U /* If a float or double field have more than this number of decimals, diff --git a/include/thr_lock.h b/include/thr_lock.h index fb69d8a693e..e6451bf21c4 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2010, 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 the terms of the GNU General Public License as published by @@ -76,10 +77,10 @@ enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1, /* Priority for locks */ -#define THR_LOCK_LATE_PRIV 1 /* For locks to be merged with org lock */ -#define THR_LOCK_MERGE_PRIV 2 /* For merge tables */ +#define THR_LOCK_LATE_PRIV 1U /* For locks to be merged with org lock */ +#define THR_LOCK_MERGE_PRIV 2U /* For merge tables */ -#define THR_UNLOCK_UPDATE_STATUS 1 +#define THR_UNLOCK_UPDATE_STATUS 1U extern ulong max_write_lock_count; extern my_bool thr_lock_inited; diff --git a/include/typelib.h b/include/typelib.h index 4504bea4ff7..eba32167c4e 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2011, 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 the terms of the GNU General Public License as published by @@ -33,13 +34,13 @@ extern int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option); #define FIND_TYPE_BASIC 0 /** makes @c find_type() require the whole name, no prefix */ -#define FIND_TYPE_NO_PREFIX (1 << 0) +#define FIND_TYPE_NO_PREFIX (1U << 0) /** always implicitely on, so unused, but old code may pass it */ #define FIND_TYPE_NO_OVERWRITE 0 /** makes @c find_type() accept a number. Not used either */ #define FIND_TYPE_ALLOW_NUMBER 0 /** makes @c find_type() treat ',' and '=' as terminators */ -#define FIND_TYPE_COMMA_TERM (1 << 3) +#define FIND_TYPE_COMMA_TERM (1U << 3) extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); diff --git a/include/violite.h b/include/violite.h index 8be9859ceb4..6047c7c8fd4 100644 --- a/include/violite.h +++ b/include/violite.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. - Copyright (c) 2012 Monty Program Ab + Copyright (c) 2012, 2017, 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 @@ -51,9 +51,9 @@ enum enum_vio_io_event VIO_IO_EVENT_CONNECT }; -#define VIO_LOCALHOST 1 /* a localhost connection */ -#define VIO_BUFFERED_READ 2 /* use buffered read */ -#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */ +#define VIO_LOCALHOST 1U /* a localhost connection */ +#define VIO_BUFFERED_READ 2U /* use buffered read */ +#define VIO_READ_BUFFER_SIZE 16384U /* size of read buffer */ #define VIO_DESCRIPTION_SIZE 30 /* size of description */ Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index bc94c9df5e8..8a4df14d4b3 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -53,7 +53,7 @@ SELECT * FROM t1; DROP TABLE t1; FLUSH LOGS; let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=XXX/ /# at [0-9]*/# at #/ /(exec_time=|end_log_pos |Xid = |thread_id=|server id |table id |mapped to number )[0-9]+/\1#/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Gtid list [[][0-9]+-[0-9]+-[0-9]+[\]]/Gtid list [#-#-#]/ /session[.](gtid_domain_id|server_id|gtid_seq_no)=[0-9]+/session.\1=#/ +--replace_regex /TIMESTAMP=[0-9]*/TIMESTAMP=XXX/ /# at [0-9]*/# at #/ /(exec_time=|end_log_pos |Xid = |thread_id=|server id |table id |mapped to number )[0-9]+/\1#/ /server v [^ ]*/server v #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Gtid list [[][0-9]+-[0-9]+-[0-9]+[\]]/Gtid list [#-#-#]/ /session[.](gtid_domain_id|server_id|gtid_seq_no)=[0-9]+/session.\1=#/ /(^#|created )[0-9]{6} [ 1][0-9]:[0-9]{2}:[0-9]{2}/\1YYMMDD HH:MM:SS/ --exec $MYSQL_BINLOG --base64-output=decode-rows -vv $MYSQLD_DATADIR/master-bin.000003 SET TIMESTAMP=DEFAULT; diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index bd681dbb343..54184f8aba1 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -939,3 +939,25 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 with cte as (select `test`.`t1`.`i` AS `i`,`test`.`t1`.`c` AS `c` from `test`.`t1`)select 1 AS `i` from dual DROP TABLE t1; +# +# MDEV-12185: view defintion contains WITH clause with +# several specifications of CTE +# +with +alias1 as (select 1 as one), +alias2 as (select 2 as two) +select one, two from alias1, alias2; +one two +1 2 +create view v1 as +with +alias1 as (select 1 as one), +alias2 as (select 2 as two) +select one, two from alias1, alias2; +select * from v1; +one two +1 2 +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with alias1 as (select 1 AS `one`), alias2 as (select 2 AS `two`)select `alias1`.`one` AS `one`,`alias2`.`two` AS `two` from (`alias1` join `alias2`) latin1 latin1_swedish_ci +drop view v1; diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result index 0624099e365..ed4fb7c61f1 100644 --- a/mysql-test/r/cte_recursive.result +++ b/mysql-test/r/cte_recursive.result @@ -699,7 +699,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra NULL UNION RESULT <union3,4,5> ALL NULL NULL NULL NULL NULL NULL 2 UNCACHEABLE SUBQUERY <derived3> ALL NULL NULL NULL NULL 12 100.00 Using where Warnings: -Note 1003 with recursive ancestor_couple_ids as (select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null)coupled_ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`), select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id` +Note 1003 with recursive ancestor_couple_ids as (select `a`.`father` AS `h_id`,`a`.`mother` AS `w_id` from `coupled_ancestors` `a` where `a`.`father` is not null and `a`.`mother` is not null), coupled_ancestors as (select `test`.`folks`.`id` AS `id`,`test`.`folks`.`name` AS `name`,`test`.`folks`.`dob` AS `dob`,`test`.`folks`.`father` AS `father`,`test`.`folks`.`mother` AS `mother` from `test`.`folks` where `test`.`folks`.`name` = 'Me' union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `fa` where `test`.`p`.`id` = `fa`.`h_id` union all select `test`.`p`.`id` AS `id`,`test`.`p`.`name` AS `name`,`test`.`p`.`dob` AS `dob`,`test`.`p`.`father` AS `father`,`test`.`p`.`mother` AS `mother` from `test`.`folks` `p` join `ancestor_couple_ids` `ma` where `test`.`p`.`id` = `ma`.`w_id`)select `h`.`name` AS `name`,`h`.`dob` AS `dob`,`w`.`name` AS `name`,`w`.`dob` AS `dob` from `ancestor_couple_ids` `c` join `coupled_ancestors` `h` join `coupled_ancestors` `w` where `h`.`id` = `c`.`h_id` and `w`.`id` = `c`.`w_id` # simple mutual recursion with recursive ancestor_couple_ids(h_id, w_id) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 0cd2655777c..5d8f71ef708 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -6333,5 +6333,18 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI drop view v1; drop table t1; # +# MDEV-10704: Assertion `field->field->table == table_arg' +# failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&, +# bool, bool) +# +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +CREATE TABLE t3 (k INT); +CREATE ALGORITHM = MERGE VIEW v AS SELECT j AS f1, k AS f2 FROM ( SELECT j FROM t1, t2 ) sq, t3; +REPLACE INTO v (f1,f2) VALUES (1,1); +ERROR HY000: Can not modify more than one base table through a join view 'test.v' +drop view v; +drop table t1,t2,t3; +# # End of 10.2 tests # diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index 1f99346a2ab..da51ec1e3b6 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -72,21 +72,21 @@ FLUSH LOGS; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 700101 6:46:40 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created YYMMDD HH:MM:SS # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# ddl /*!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*!100001 SET @@session.gtid_domain_id=#*//*!*/; /*!100001 SET @@session.server_id=#*//*!*/; /*!100001 SET @@session.gtid_seq_no=#*//*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 use `test`/*!*/; SET TIMESTAMP=XXX/*!*/; SET @@session.pseudo_thread_id=#/*!*/; @@ -100,135 +100,135 @@ SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8) /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES ('ä(i1)') -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1='ä(i1)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES ('ä(i2)') -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1='ä(i2)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES ('ä(i3)') -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1='ä(i3)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES ('ä(p1)') -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1='ä(p1)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES ('ä(p2)') -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1='ä(p2)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Annotate_rows: +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES ('ä(p3)') -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Table_map: `test`.`t1` mapped to number # # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1='ä(p3)' /* VARSTRING(30) meta=30 nullable=1 is_null=0 */ # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# ddl /*!100001 SET @@session.gtid_seq_no=#*//*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; DROP TABLE `t1` /* generated by server */ /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index 693c252c1ad..6c82c5793df 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -76,21 +76,21 @@ FLUSH LOGS; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created 700101 6:46:40 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Start: binlog v 4, server v #.##.## created YYMMDD HH:MM:SS # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Gtid list [#-#-#] # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000002 # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Binlog checkpoint master-bin.000003 # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# ddl /*!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*!100001 SET @@session.gtid_domain_id=#*//*!*/; /*!100001 SET @@session.server_id=#*//*!*/; /*!100001 SET @@session.gtid_seq_no=#*//*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 use `test`/*!*/; SET TIMESTAMP=XXX/*!*/; SET @@session.pseudo_thread_id=#/*!*/; @@ -104,105 +104,105 @@ SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8) /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; INSERT INTO t1 VALUES ('ä(i1)') /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; INSERT INTO t1 VALUES ('ä(i2)') /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; INSERT INTO t1 VALUES ('ä(i3)') /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; INSERT INTO t1 VALUES ('ä(p1)') /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; INSERT INTO t1 VALUES ('ä(p2)') /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# /*!100001 SET @@session.gtid_seq_no=#*//*!*/; BEGIN /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; INSERT INTO t1 VALUES ('ä(p3)') /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; COMMIT /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX GTID #-#-# ddl +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX GTID #-#-# ddl /*!100001 SET @@session.gtid_seq_no=#*//*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Query thread_id=# exec_time=# error_code=0 SET TIMESTAMP=XXX/*!*/; DROP TABLE `t1` /* generated by server */ /*!*/; # at # -#700101 6:46:40 server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 +#YYMMDD HH:MM:SS server id # end_log_pos # CRC32 XXX Rotate to master-bin.000004 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result b/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result index 65e03a028a0..957a8c1eec9 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result +++ b/mysql-test/suite/encryption/r/innodb_encrypt_log_corruption.result @@ -66,7 +66,8 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND /InnoDB: Log scan progressed past the checkpoint lsn 1213964/ in mysqld.1.err +FOUND /InnoDB: Starting crash recovery from checkpoint LSN=1213964/ in mysqld.1.err +FOUND /InnoDB: MLOG_FILE_NAME incorrect:bogus/ in mysqld.1.err FOUND /InnoDB: ############### CORRUPT LOG RECORD FOUND ##################/ in mysqld.1.err FOUND /InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0/ in mysqld.1.err FOUND /len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus / in mysqld.1.err @@ -83,7 +84,14 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND /InnoDB: MLOG_FILE_NAME incorrect:bigot/ in mysqld.1.err FOUND /len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;/ in mysqld.1.err +# missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +NOT FOUND /InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42$/ in mysqld.1.err # Minimal MariaDB 10.1.21 encrypted redo log SELECT COUNT(*) `1` FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index be4eb210f2f..20c1cb39f87 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -30,12 +30,6 @@ galera_gcs_fragment : Incorrect arguments to SET galera_flush_local : Fails sporadically galera_binlog_stmt_autoinc : TODO: investigate galera_concurrent_ctas : Test times out, investigate -MW-258 : MDEV-11229 -galera_as_master : MDEV-11229 -MW-44 : MDEV-11229 -galera_gcs_fc_limit : MDEV-11229 -galera_roles : MDEV-11229 -galera_lock_table : MDEV-11229 MW-286 : TODO: investigate galera_sst_xtrabackup-v2-options : TODO: Fix test case galera_sst_xtrabackup-v2 : MDEV-11208 diff --git a/mysql-test/suite/galera/t/MW-258.test b/mysql-test/suite/galera/t/MW-258.test index f5519f8a081..f00b82d6bb4 100644 --- a/mysql-test/suite/galera/t/MW-258.test +++ b/mysql-test/suite/galera/t/MW-258.test @@ -34,6 +34,7 @@ UNLOCK TABLES; --connection node_1 --echo value after RSU: +--sleep 2 SHOW STATUS LIKE 'wsrep_desync_count'; SHOW VARIABLES LIKE 'wsrep_desync'; SET GLOBAL wsrep_desync=0; diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test index 55a3fd57f80..133676b9141 100644 --- a/mysql-test/suite/galera/t/MW-44.test +++ b/mysql-test/suite/galera/t/MW-44.test @@ -8,9 +8,11 @@ --connection node_1 TRUNCATE TABLE mysql.general_log; +--sleep 1 --connection node_2 TRUNCATE TABLE mysql.general_log; +--sleep 1 --connection node_1 SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test index 93f9224b258..a56fb6dc976 100644 --- a/mysql-test/suite/galera/t/galera_as_master.test +++ b/mysql-test/suite/galera/t/galera_as_master.test @@ -27,6 +27,7 @@ CREATE TABLE test.t3 AS SELECT * from t1; SET SQL_LOG_BIN=ON; INSERT INTO t1 VALUES(3); CREATE TABLE test.t4 AS SELECT * from t1; +--save_master_pos --connection node_2 SELECT * FROM t1; @@ -35,28 +36,21 @@ SELECT * FROM t3; SELECT * FROM t4; --connection node_3 +--sync_with_master SHOW TABLES; ---let $wait_condition = SELECT COUNT(*) = 2 FROM t1; ---source include/wait_condition.inc - ---let $wait_condition = SELECT COUNT(*) = 3 FROM t4; ---source include/wait_condition.inc - SELECT * FROM t1; SELECT * FROM t4; --echo # Cleanup --connection node_1 DROP TABLE t1, t4; +--save_master_pos SET SQL_LOG_BIN=OFF; DROP TABLE t2, t3; --connection node_3 ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; ---source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't4'; ---source include/wait_condition.inc +--sync_with_master STOP SLAVE; RESET SLAVE ALL; diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test index 721d84ecb05..dc65a452d7c 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test +++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test @@ -19,10 +19,13 @@ SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; LOCK TABLE t1 WRITE; --connection node_1 - +--sleep 1 INSERT INTO t1 VALUES (2); +--sleep 1 INSERT INTO t1 VALUES (3); +--sleep 1 INSERT INTO t1 VALUES (4); +--sleep 1 # This query will hang because flow control will kick in --send diff --git a/mysql-test/suite/galera/t/galera_lock_table.test b/mysql-test/suite/galera/t/galera_lock_table.test index bd581842f6f..0bcaf646917 100644 --- a/mysql-test/suite/galera/t/galera_lock_table.test +++ b/mysql-test/suite/galera/t/galera_lock_table.test @@ -11,6 +11,8 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; +--sleep 1 + --connection node_2 LOCK TABLE t1 READ; diff --git a/mysql-test/suite/galera/t/galera_roles.test b/mysql-test/suite/galera/t/galera_roles.test index 16e417d1fdb..79951ad10c8 100644 --- a/mysql-test/suite/galera/t/galera_roles.test +++ b/mysql-test/suite/galera/t/galera_roles.test @@ -36,6 +36,7 @@ GRANT SELECT (a) ON test1.t2 TO role1; --connect(foo_node_1,127.0.0.1,foo,,test,$port_1,) --let $port_2= \$NODE_MYPORT_2 +--sleep 1 --connect(foo_node_2,127.0.0.1,foo,,test,$port_2,) --echo @@ -107,7 +108,7 @@ CALL test1.pr1(); --echo --echo # Connect with foo_node_2 --connection foo_node_2 - +--sleep 1 --error ER_PROCACCESS_DENIED_ERROR CALL test1.pr1(); diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb/r/innodb_information_schema.result index 15c3af325ad..36c76b03bd0 100644 --- a/mysql-test/suite/innodb/r/innodb_information_schema.result +++ b/mysql-test/suite/innodb/r/innodb_information_schema.result @@ -43,7 +43,6 @@ trx_unique_checks int(1) NO 0 trx_foreign_key_checks int(1) NO 0 trx_last_foreign_key_error varchar(256) YES NULL trx_adaptive_hash_latched int(1) NO 0 -trx_adaptive_hash_timeout bigint(21) unsigned NO 0 trx_is_read_only int(1) NO 0 trx_autocommit_non_locking int(1) NO 0 trx_state trx_weight trx_tables_in_use trx_tables_locked trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks diff --git a/mysql-test/suite/innodb/r/innodb_monitor.result b/mysql-test/suite/innodb/r/innodb_monitor.result deleted file mode 100644 index 263da6070b2..00000000000 --- a/mysql-test/suite/innodb/r/innodb_monitor.result +++ /dev/null @@ -1,619 +0,0 @@ -set global innodb_monitor_disable = All; -select name, status from information_schema.innodb_metrics; -name status -metadata_table_handles_opened disabled -metadata_table_handles_closed disabled -metadata_table_reference_count disabled -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -buffer_pool_size disabled -buffer_pool_reads disabled -buffer_pool_read_requests disabled -buffer_pool_write_requests disabled -buffer_pool_wait_free disabled -buffer_pool_read_ahead disabled -buffer_pool_read_ahead_evicted disabled -buffer_pool_pages_total disabled -buffer_pool_pages_misc disabled -buffer_pool_pages_data disabled -buffer_pool_bytes_data disabled -buffer_pool_pages_dirty disabled -buffer_pool_bytes_dirty disabled -buffer_pool_pages_free disabled -buffer_pages_created disabled -buffer_pages_written disabled -buffer_index_pages_written disabled -buffer_non_index_pages_written disabled -buffer_pages_read disabled -buffer_pages0_read disabled -buffer_index_sec_rec_cluster_reads disabled -buffer_index_sec_rec_cluster_reads_avoided disabled -buffer_data_reads disabled -buffer_data_written disabled -buffer_flush_batch_scanned disabled -buffer_flush_batch_num_scan disabled -buffer_flush_batch_scanned_per_call disabled -buffer_flush_batch_total_pages disabled -buffer_flush_batches disabled -buffer_flush_batch_pages disabled -buffer_flush_neighbor_total_pages disabled -buffer_flush_neighbor disabled -buffer_flush_neighbor_pages disabled -buffer_flush_n_to_flush_requested disabled -buffer_flush_n_to_flush_by_age disabled -buffer_flush_adaptive_avg_time_slot disabled -buffer_LRU_batch_flush_avg_time_slot disabled -buffer_flush_adaptive_avg_time_thread disabled -buffer_LRU_batch_flush_avg_time_thread disabled -buffer_flush_adaptive_avg_time_est disabled -buffer_LRU_batch_flush_avg_time_est disabled -buffer_flush_avg_time disabled -buffer_flush_adaptive_avg_pass disabled -buffer_LRU_batch_flush_avg_pass disabled -buffer_flush_avg_pass disabled -buffer_LRU_get_free_loops disabled -buffer_LRU_get_free_waits disabled -buffer_flush_avg_page_rate disabled -buffer_flush_lsn_avg_rate disabled -buffer_flush_pct_for_dirty disabled -buffer_flush_pct_for_lsn disabled -buffer_flush_sync_waits disabled -buffer_flush_adaptive_total_pages disabled -buffer_flush_adaptive disabled -buffer_flush_adaptive_pages disabled -buffer_flush_sync_total_pages disabled -buffer_flush_sync disabled -buffer_flush_sync_pages disabled -buffer_flush_background_total_pages disabled -buffer_flush_background disabled -buffer_flush_background_pages disabled -buffer_LRU_batch_scanned disabled -buffer_LRU_batch_num_scan disabled -buffer_LRU_batch_scanned_per_call disabled -buffer_LRU_batch_flush_total_pages disabled -buffer_LRU_batches_flush disabled -buffer_LRU_batch_flush_pages disabled -buffer_LRU_batch_evict_total_pages disabled -buffer_LRU_batches_evict disabled -buffer_LRU_batch_evict_pages disabled -buffer_LRU_single_flush_scanned disabled -buffer_LRU_single_flush_num_scan disabled -buffer_LRU_single_flush_scanned_per_call disabled -buffer_LRU_single_flush_failure_count disabled -buffer_LRU_get_free_search disabled -buffer_LRU_search_scanned disabled -buffer_LRU_search_num_scan disabled -buffer_LRU_search_scanned_per_call disabled -buffer_LRU_unzip_search_scanned disabled -buffer_LRU_unzip_search_num_scan disabled -buffer_LRU_unzip_search_scanned_per_call disabled -buffer_page_read_index_leaf disabled -buffer_page_read_index_non_leaf disabled -buffer_page_read_index_ibuf_leaf disabled -buffer_page_read_index_ibuf_non_leaf disabled -buffer_page_read_undo_log disabled -buffer_page_read_index_inode disabled -buffer_page_read_ibuf_free_list disabled -buffer_page_read_ibuf_bitmap disabled -buffer_page_read_system_page disabled -buffer_page_read_trx_system disabled -buffer_page_read_fsp_hdr disabled -buffer_page_read_xdes disabled -buffer_page_read_blob disabled -buffer_page_read_zblob disabled -buffer_page_read_zblob2 disabled -buffer_page_read_other disabled -buffer_page_written_index_leaf disabled -buffer_page_written_index_non_leaf disabled -buffer_page_written_index_ibuf_leaf disabled -buffer_page_written_index_ibuf_non_leaf disabled -buffer_page_written_undo_log disabled -buffer_page_written_index_inode disabled -buffer_page_written_ibuf_free_list disabled -buffer_page_written_ibuf_bitmap disabled -buffer_page_written_system_page disabled -buffer_page_written_trx_system disabled -buffer_page_written_fsp_hdr disabled -buffer_page_written_xdes disabled -buffer_page_written_blob disabled -buffer_page_written_zblob disabled -buffer_page_written_zblob2 disabled -buffer_page_written_other disabled -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs disabled -os_pending_reads disabled -os_pending_writes disabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs disabled -os_log_pending_writes disabled -trx_rw_commits disabled -trx_ro_commits disabled -trx_nl_ro_commits disabled -trx_commits_insert_update disabled -trx_rollbacks disabled -trx_rollbacks_savepoint disabled -trx_rollback_active disabled -trx_active_transactions disabled -trx_rseg_history_len disabled -trx_undo_slots_used disabled -trx_undo_slots_cached disabled -trx_rseg_current_size disabled -purge_del_mark_records disabled -purge_upd_exist_or_extern_records disabled -purge_invoked disabled -purge_undo_log_pages disabled -purge_dml_delay_usec disabled -purge_stop_count disabled -purge_resume_count disabled -log_checkpoints disabled -log_lsn_last_flush disabled -log_lsn_last_checkpoint disabled -log_lsn_current disabled -log_lsn_checkpoint_age disabled -log_lsn_buf_pool_oldest disabled -log_max_modified_age_async disabled -log_max_modified_age_sync disabled -log_pending_log_flushes disabled -log_pending_checkpoint_writes disabled -log_num_log_io disabled -log_waits disabled -log_write_requests disabled -log_writes disabled -log_padded disabled -compress_pages_compressed disabled -compress_pages_decompressed disabled -compression_pad_increments disabled -compression_pad_decrements disabled -compress_saved disabled -compress_pages_page_compressed disabled -compress_page_compressed_trim_op disabled -compress_pages_page_decompressed disabled -compress_pages_page_compression_error disabled -compress_pages_encrypted disabled -compress_pages_decrypted disabled -index_page_splits disabled -index_page_merge_attempts disabled -index_page_merge_successful disabled -index_page_reorg_attempts disabled -index_page_reorg_successful disabled -index_page_discards disabled -adaptive_hash_searches disabled -adaptive_hash_searches_btree disabled -adaptive_hash_pages_added disabled -adaptive_hash_pages_removed disabled -adaptive_hash_rows_added disabled -adaptive_hash_rows_removed disabled -adaptive_hash_rows_deleted_no_hash_entry disabled -adaptive_hash_rows_updated disabled -file_num_open_files disabled -ibuf_merges_insert disabled -ibuf_merges_delete_mark disabled -ibuf_merges_delete disabled -ibuf_merges_discard_insert disabled -ibuf_merges_discard_delete_mark disabled -ibuf_merges_discard_delete disabled -ibuf_merges disabled -ibuf_size disabled -innodb_master_thread_sleeps disabled -innodb_activity_count disabled -innodb_master_active_loops disabled -innodb_master_idle_loops disabled -innodb_background_drop_table_usec disabled -innodb_ibuf_merge_usec disabled -innodb_log_flush_usec disabled -innodb_mem_validate_usec disabled -innodb_master_purge_usec disabled -innodb_dict_lru_usec disabled -innodb_dict_lru_count_active disabled -innodb_dict_lru_count_idle disabled -innodb_checkpoint_usec disabled -innodb_dblwr_writes disabled -innodb_dblwr_pages_written disabled -innodb_page_size disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -dml_reads disabled -dml_inserts disabled -dml_deletes disabled -dml_updates disabled -dml_system_reads disabled -dml_system_inserts disabled -dml_system_deletes disabled -dml_system_updates disabled -ddl_background_drop_indexes disabled -ddl_background_drop_tables disabled -ddl_online_create_index disabled -ddl_pending_alter_table disabled -ddl_sort_file_alter_table disabled -ddl_log_file_alter_table disabled -icp_attempts disabled -icp_no_match disabled -icp_out_of_range disabled -icp_match disabled -set global innodb_monitor_enable = all; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_enable = aaa; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' -set global innodb_monitor_disable = All; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_reset_all = all; -select name from information_schema.innodb_metrics where count!=0; -name -set global innodb_monitor_enable = "%lock%"; -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); -name -set global innodb_monitor_disable = "%lock%"; -select name, status from information_schema.innodb_metrics -where name like "%lock%"; -name status -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -set global innodb_monitor_enable = "%lock*"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%%%%%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%_%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="log%%%%"; -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); -name -set global innodb_monitor_enable="os_%a_fs_ncs"; -set global innodb_monitor_enable="os%pending%"; -select name, status from information_schema.innodb_metrics -where name like "os%"; -name status -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs enabled -os_pending_reads enabled -os_pending_writes enabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs enabled -os_log_pending_writes enabled -set global innodb_monitor_enable=""; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' -set global innodb_monitor_enable="_"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' -set global innodb_monitor_disable = module_metadata; -set global innodb_monitor_reset_all = module_metadata; -set global innodb_monitor_enable = metadata_table_handles_opened; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_disable = metadata_table_handles_opened; -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = metadata_table_handles_opened; -drop table monitor_test; -create table monitor_test(col int) engine = innodb stats_persistent=0; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_enable = metadata_table_handles_closed; -create index idx on monitor_test(col); -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_metadata; -set global innodb_monitor_reset = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_reset_all = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = module_trx; -begin; -insert into monitor_test values(9); -commit; -begin; -insert into monitor_test values(9); -rollback; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; -name max_count min_count count max_count_reset min_count_reset count_reset status -trx_rollbacks 1 NULL 1 1 NULL 1 enabled -trx_active_transactions 1 0 0 1 0 0 enabled -set global innodb_monitor_disable = module_trx; -set global innodb_monitor_enable = module_dml; -insert into monitor_test values(9); -update monitor_test set col = 10 where col = 9; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 4 NULL 4 4 NULL 4 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 0 NULL 0 0 NULL 0 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 6 NULL 6 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 2 NULL 2 2 NULL 2 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 0 NULL 0 enabled -dml_inserts 1 NULL 1 0 NULL 0 enabled -dml_deletes 2 NULL 2 0 NULL 0 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_disable = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 disabled -dml_inserts 3 NULL 3 2 NULL 2 disabled -dml_deletes 4 NULL 4 2 NULL 2 disabled -dml_updates 2 NULL 2 0 NULL 0 disabled -dml_system_reads 0 NULL 0 0 NULL 0 disabled -dml_system_inserts 0 NULL 0 0 NULL 0 disabled -dml_system_deletes 0 NULL 0 0 NULL 0 disabled -dml_system_updates 0 NULL 0 0 NULL 0 disabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts NULL NULL 0 NULL NULL 0 disabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = dml_inserts; -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts 2 NULL 2 2 NULL 2 enabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_dml; -drop table monitor_test; -set global innodb_monitor_enable = file_num_open_files; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; -name max_count min_count count max_count_reset min_count_reset count_reset status -file_num_open_files # # # # # # enabled -set global innodb_monitor_disable = file_num_open_files; -set global innodb_monitor_enable = "icp%"; -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; -insert into monitor_test values("13", 2, "aa"); -select a from monitor_test where b < 1 for update; -a -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 1 -icp_no_match 0 -icp_out_of_range 1 -icp_match 0 -select a from monitor_test where b < 3 for update; -a -13 -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 2 -icp_no_match 0 -icp_out_of_range 1 -icp_match 1 -drop table monitor_test; -set global innodb_monitor_disable = all; -set global innodb_monitor_reset_all = all; -select 1 from `information_schema`.`INNODB_METRICS` -where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; -1 -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index f515cb047f1..a031cfaa278 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -1,5 +1,5 @@ select * from information_schema.innodb_trx; -trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched trx_adaptive_hash_timeout trx_is_read_only trx_autocommit_non_locking +trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched trx_is_read_only trx_autocommit_non_locking Warnings: Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_trx but the InnoDB storage engine is not installed select * from information_schema.innodb_locks; diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result index ccf5f73a3a3..a932efeca62 100644 --- a/mysql-test/suite/innodb/r/log_corruption.result +++ b/mysql-test/suite/innodb/r/log_corruption.result @@ -66,7 +66,8 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS -FOUND /InnoDB: Log scan progressed past the checkpoint lsn 1213964/ in mysqld.1.err +FOUND /InnoDB: Starting crash recovery from checkpoint LSN=1213964/ in mysqld.1.err +FOUND /InnoDB: MLOG_FILE_NAME incorrect:bogus/ in mysqld.1.err FOUND /InnoDB: ############### CORRUPT LOG RECORD FOUND ##################/ in mysqld.1.err FOUND /InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0/ in mysqld.1.err FOUND /len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus / in mysqld.1.err @@ -83,7 +84,14 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +FOUND /InnoDB: MLOG_FILE_NAME incorrect:bigot/ in mysqld.1.err FOUND /len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ;/ in mysqld.1.err +# missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT +SELECT * FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +NOT FOUND /InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42$/ in mysqld.1.err # Minimal MariaDB 10.1.21 encrypted redo log SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result b/mysql-test/suite/innodb/r/monitor.result index ccd8e482756..33a09a553b9 100644 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -610,7 +610,59 @@ icp_match 1 drop table monitor_test; set global innodb_monitor_disable = All; set global innodb_monitor_reset_all = all; +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; +1 set global innodb_monitor_enable = default; set global innodb_monitor_disable = default; set global innodb_monitor_reset = default; set global innodb_monitor_reset_all = default; +# +# Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL +# MONITORS +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT +buffer_page_written_index_leaf 0 +SET GLOBAL innodb_monitor_enable='module_buffer_page'; +INSERT INTO t1 VALUES (1), (2), (3), (4); +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT +buffer_page_written_index_leaf NNNN +SET GLOBAL innodb_monitor_disable='module_buffer_page'; +SET GLOBAL innodb_monitor_reset_all='module_buffer_page'; +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT +buffer_page_written_index_leaf 0 +SET GLOBAL innodb_monitor_enable='%'; +INSERT INTO t1 VALUES (5), (6), (7), (8); +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT +buffer_page_written_index_leaf NNNN +SET GLOBAL innodb_monitor_disable='%'; +SET GLOBAL innodb_monitor_reset_all='%'; +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT +buffer_page_written_index_leaf 0 +SET GLOBAL innodb_monitor_enable='ALL'; +INSERT INTO t1 VALUES (9), (10), (11), (12); +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; +NAME COUNT +buffer_page_written_index_leaf NNNN +SET GLOBAL innodb_monitor_enable=default; +SET GLOBAL innodb_monitor_disable=default; +SET GLOBAL innodb_monitor_reset_all=default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_monitor.test b/mysql-test/suite/innodb/t/innodb_monitor.test deleted file mode 100644 index 864e0cae862..00000000000 --- a/mysql-test/suite/innodb/t/innodb_monitor.test +++ /dev/null @@ -1,387 +0,0 @@ -# This is the test for Metrics Monitor Table feature. -# Test the metrics monitor system's control system -# and counter accuracy. - ---source include/have_innodb.inc - -set global innodb_monitor_disable = All; - -# Test turn on/off the monitor counter with "all" option -# By default, they will be off -select name, status from information_schema.innodb_metrics; - -# Turn on all monitor counters -set global innodb_monitor_enable = all; - -# status should all change to "enabled" -select name from information_schema.innodb_metrics where status!='enabled'; - -# Test wrong argument to the global configure option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = aaa; - -# We require a valid monitor counter/module name. There is no default -# counter name or module. A warning will be printed asking user to -# specify a valid counter name. -#--disable_warnings -#set global innodb_monitor_enable = default; -#--enable_warnings - -# Turn off all monitor counters, option name should be case -# insensitive -set global innodb_monitor_disable = All; - -# status should all change to "disabled" -select name from information_schema.innodb_metrics where status!='disabled'; - -# Reset all counter values -set global innodb_monitor_reset_all = all; - -# count should all change to 0 -select name from information_schema.innodb_metrics where count!=0; - -# Test wildcard match, turn on all counters contain string "lock" -set global innodb_monitor_enable = "%lock%"; - -# All lock related counter should be enabled -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); - -# Disable them -set global innodb_monitor_disable = "%lock%"; - -# All lock related counter should be disabled -select name, status from information_schema.innodb_metrics -where name like "%lock%"; - -# No match for "%lock*" ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = "%lock*"; - -# All counters will be turned on with wildcard match string with all "%" -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all counters -set global innodb_monitor_disable="%%%%%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# One more round testing. All counters will be turned on with -# single wildcard character "%" -set global innodb_monitor_enable="%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all the counters with "%_%" -set global innodb_monitor_disable="%_%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# Turn on all counters start with "log" -set global innodb_monitor_enable="log%%%%"; - -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); - -# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_" -# is single character wildcard match word -set global innodb_monitor_enable="os_%a_fs_ncs"; - -# Turn on counters whose name contains "os" and "pending" with -# wildcard match "os%pending%" -set global innodb_monitor_enable="os%pending%"; - -select name, status from information_schema.innodb_metrics -where name like "os%"; - -# Empty string is an invalid option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable=""; - ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable="_"; - -# Reset counters only in "module_metadata" module -set global innodb_monitor_disable = module_metadata; - -set global innodb_monitor_reset_all = module_metadata; - -# Only turn on "table_open" counter -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# This will open the monitor_test table -select * from monitor_test; - -# "metadata_table_handles_opened" should increment by 1 -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset the counter value while counter is still on (started) -# This will reset value "count_reset" but not -# "count" -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again to increment "metadata_table_handles_opened" again -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Cannot reset all monitor value while the counter is on -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn off the counter "metadata_table_handles_opened" -set global innodb_monitor_disable = metadata_table_handles_opened; - -# Reset the counter value while counter is off (disabled) -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again. Since monitor is off, "metadata_table_handles_opened" -# should not be incremented -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# "metadata_table_handles_opened" should increment -select * from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset all the counters, include those counter *_since_start -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn on "table_open" counter again -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Test metadata_table_handles_opened again to see if it is working correctly -# after above round of turning on/off/reset -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb stats_persistent=0; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Test counter "metadata_table_handles_closed", -# create index will close the old handle -set global innodb_monitor_enable = metadata_table_handles_closed; - -create index idx on monitor_test(col); - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Reset counters only in "module_metadata" module -set global innodb_monitor_disable = module_metadata; - -set global innodb_monitor_reset = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -set global innodb_monitor_reset_all = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Test Transaction Module -set global innodb_monitor_enable = module_trx; - -begin; -insert into monitor_test values(9); -commit; - -begin; -insert into monitor_test values(9); -rollback; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; - -set global innodb_monitor_disable = module_trx; - -# Test DML Module -set global innodb_monitor_enable = module_dml; - -insert into monitor_test values(9); - -update monitor_test set col = 10 where col = 9; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status - from information_schema.innodb_metrics - where name like "dml%"; - -# test reset counter while the counter is on -set global innodb_monitor_reset = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# insert/delete some rows after the reset -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# We do not allow reset_all while the counter is on, nothing -# should be reset here -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Turn off the counter -set global innodb_monitor_disable = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Reset all counter values -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Open individual counter "dml_inserts" -set global innodb_monitor_enable = dml_inserts; - -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -# Only counter "dml_inserts" should be updated -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -set global innodb_monitor_disable = module_dml; - -drop table monitor_test; - -set global innodb_monitor_enable = file_num_open_files; - -# Counters are unpredictable when innodb-file-per-table is on ---replace_column 2 # 3 # 4 # 5 # 6 # 7 # -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; - -set global innodb_monitor_disable = file_num_open_files; - -# Test ICP module counters -set global innodb_monitor_enable = "icp%"; - -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; - -insert into monitor_test values("13", 2, "aa"); - -select a from monitor_test where b < 1 for update; - -# should have icp_attempts = 1 and icp_out_of_range = 1 -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -# should have icp_attempts = 2 and icp_match = 1 -select a from monitor_test where b < 3 for update; - -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -drop table monitor_test; - -set global innodb_monitor_disable = all; -set global innodb_monitor_reset_all = all; - -# Test for bug #13966091 -select 1 from `information_schema`.`INNODB_METRICS` -where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; - --- disable_warnings -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; --- enable_warnings diff --git a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits-master.opt b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits-master.opt index 22272485540..dbac5bb16a9 100644 --- a/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits-master.opt +++ b/mysql-test/suite/innodb/t/innodb_sys_semaphore_waits-master.opt @@ -1,3 +1,2 @@ --innodb-fatal-semaphore-wait-threshold=1 --innodb-sys-semaphore-waits=1 ---innodb-instrument-semaphores=1 diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test index d193b3e74a8..2e628065199 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -13,6 +13,7 @@ call mtr.add_suppression("InnoDB: Missing MLOG_CHECKPOINT"); call mtr.add_suppression("InnoDB: MLOG_FILE_NAME incorrect"); call mtr.add_suppression("InnoDB: ############### CORRUPT LOG RECORD FOUND"); call mtr.add_suppression("InnoDB: Log scan aborted at LSN"); +call mtr.add_suppression("InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42\\r?$"); call mtr.add_suppression("InnoDB: Obtaining redo log encryption key version 1 failed"); call mtr.add_suppression("InnoDB: Decrypting checkpoint failed"); --enable_query_log @@ -261,7 +262,9 @@ EOF --source include/start_mysqld.inc eval $check_no_innodb; --source include/shutdown_mysqld.inc -let SEARCH_PATTERN=InnoDB: Log scan progressed past the checkpoint lsn 1213964; +let SEARCH_PATTERN=InnoDB: Starting crash recovery from checkpoint LSN=1213964; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=InnoDB: MLOG_FILE_NAME incorrect:bogus; --source include/search_pattern_in_file.inc let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################; --source include/search_pattern_in_file.inc @@ -313,9 +316,42 @@ EOF --source include/start_mysqld.inc eval $check_no_innodb; --source include/shutdown_mysqld.inc +let SEARCH_PATTERN=InnoDB: MLOG_FILE_NAME incorrect:bigot; +--source include/search_pattern_in_file.inc --let SEARCH_PATTERN= len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ; --source include/search_pattern_in_file.inc +--echo # missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +# header block +print OUT pack("Nx[5]nx[5]", 1, 0x1286); +print OUT "ibbackup was here!!!1!"; +print OUT pack("x[470]N", 0x52b54540); +# invalid (all-zero) checkpoint page 1 and an empty log page +print OUT chr(0) x 1024; +# valid checkpoint block 2 +print OUT pack("x[12]NNNx[264]", 0x12860c, 0, 0x80c); +# pointer to the MLOG_CHECKPOINT record, and checkpoint page checksum +print OUT pack("H*x[204]NNN", "590DBAACFE922582", 0x128612, 0, 0x101741b); +# log page +print OUT pack("H*", "800009440022000c00000001"); +# MLOG_1BYTE record for missing tablespace 42 page 123 +print OUT pack("CCCnC", 128 | 1, 42, 123, 4567, 89); +# MLOG_CHECKPOINT record +print OUT pack("CNN", 56, 0, 0x12860c); +# padding (MLOG_DUMMY_RECORD) and block checksum +print OUT " " x 481, pack("N", 0x644e6db8); +close OUT or die; +EOF + +--source include/start_mysqld.inc +eval $check_no_innodb; +--source include/shutdown_mysqld.inc +--let SEARCH_PATTERN= InnoDB: Missing MLOG_FILE_NAME or MLOG_FILE_DELETE before MLOG_CHECKPOINT for tablespace 42\$ +--source include/search_pattern_in_file.inc + --echo # Minimal MariaDB 10.1.21 encrypted redo log perl; die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test index d8edcda28e5..4705ca68091 100644 --- a/mysql-test/suite/innodb/t/log_file_size.test +++ b/mysql-test/suite/innodb/t/log_file_size.test @@ -73,15 +73,13 @@ let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir; --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; +let SEARCH_PATTERN= InnoDB: Starting crash recovery from checkpoint LSN=; --source include/search_pattern_in_file.inc --let $restart_parameters= --debug=d,innodb_log_abort_3 --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; ---source include/search_pattern_in_file.inc --let $restart_parameters= --innodb-read-only --source include/restart_mysqld.inc @@ -95,8 +93,6 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; ---source include/search_pattern_in_file.inc let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; --source include/search_pattern_in_file.inc @@ -104,8 +100,6 @@ let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; ---source include/search_pattern_in_file.inc let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; --source include/search_pattern_in_file.inc @@ -121,8 +115,6 @@ let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; -let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; ---source include/search_pattern_in_file.inc let SEARCH_PATTERN= redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/sys_vars/t/innodb_monitor_disable_basic.test b/mysql-test/suite/innodb/t/monitor.test index 1b23ae14e49..98aa4505e34 100644 --- a/mysql-test/suite/sys_vars/t/innodb_monitor_disable_basic.test +++ b/mysql-test/suite/innodb/t/monitor.test @@ -1,11 +1,13 @@ -# This is the test for Metrics Monitor Table feature. -# Test the metrics monitor system's control system -# and counter accuracy. +# This test used to be duplicated in the following: +# sys_vars.innodb_monitor_reset_basic +# sys_vars.innodb_monitor_reset_all_basic +# sys_vars.innodb_monitor_disable_basic +# sys_vars.innodb_monitor_enable_basic --source include/have_innodb.inc set global innodb_monitor_disable = All; # Test turn on/off the monitor counter with "all" option -# By default, they will be off +# By default, they will be off. select name, status from information_schema.innodb_metrics; # Turn on all monitor counters @@ -370,9 +372,66 @@ drop table monitor_test; set global innodb_monitor_disable = All; set global innodb_monitor_reset_all = all; +# Test for bug #13966091 +select 1 from `information_schema`.`INNODB_METRICS` +where case (1) when (1) then (AVG_COUNT_RESET) else (1) end; + -- disable_warnings set global innodb_monitor_enable = default; set global innodb_monitor_disable = default; set global innodb_monitor_reset = default; set global innodb_monitor_reset_all = default; -- enable_warnings + +--echo # +--echo # Bug#22576241 SETTING INNODB_MONITOR_ENABLE TO ALL DOES NOT ENABLE ALL +--echo # MONITORS +--echo # +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; + +let $innodb_monitor_enable = `SELECT @@innodb_monitor_enable`; + +--replace_regex /[1-9]/NNNN/ +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; + +SET GLOBAL innodb_monitor_enable='module_buffer_page'; +INSERT INTO t1 VALUES (1), (2), (3), (4); FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +--replace_regex /[1-9]/NNNN/ +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; + +SET GLOBAL innodb_monitor_disable='module_buffer_page'; +SET GLOBAL innodb_monitor_reset_all='module_buffer_page'; +--replace_regex /[1-9]/NNNN/ +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; + +SET GLOBAL innodb_monitor_enable='%'; +INSERT INTO t1 VALUES (5), (6), (7), (8); FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +--replace_regex /[1-9]/NNNN/ +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; + +SET GLOBAL innodb_monitor_disable='%'; +SET GLOBAL innodb_monitor_reset_all='%'; +--replace_regex /[1-9]/NNNN/ +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; + +SET GLOBAL innodb_monitor_enable='ALL'; +INSERT INTO t1 VALUES (9), (10), (11), (12); FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +--replace_regex /[1-9]/NNNN/ +SELECT NAME, COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME +LIKE 'buffer_page_written_index_leaf'; + +--disable_warnings +SET GLOBAL innodb_monitor_enable=default; +SET GLOBAL innodb_monitor_disable=default; +SET GLOBAL innodb_monitor_reset_all=default; +--enable_warnings + +DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores.result b/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores.result deleted file mode 100644 index dc8fba41e0b..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores.result +++ /dev/null @@ -1,45 +0,0 @@ -# -# innodb_instrument_semaphores -# -# save the initial value -SET @innodb_instrument_semaphores_global_saved = @@global.innodb_instrument_semaphores; -# default -SELECT @@global.innodb_instrument_semaphores; -@@global.innodb_instrument_semaphores -0 - -# scope -SELECT @@session.innodb_instrument_semaphores; -ERROR HY000: Variable 'innodb_instrument_semaphores' is a GLOBAL variable -SET @@global.innodb_instrument_semaphores=OFF; -SELECT @@global.innodb_instrument_semaphores; -@@global.innodb_instrument_semaphores -0 -SET @@global.innodb_instrument_semaphores=ON; -SELECT @@global.innodb_instrument_semaphores; -@@global.innodb_instrument_semaphores -1 - -# valid values -SET @@global.innodb_instrument_semaphores='OFF'; -SELECT @@global.innodb_instrument_semaphores; -@@global.innodb_instrument_semaphores -0 -SET @@global.innodb_instrument_semaphores=ON; -SELECT @@global.innodb_instrument_semaphores; -@@global.innodb_instrument_semaphores -1 -SET @@global.innodb_instrument_semaphores=default; -SELECT @@global.innodb_instrument_semaphores; -@@global.innodb_instrument_semaphores -0 - -# invalid values -SET @@global.innodb_instrument_semaphores=NULL; -ERROR 42000: Variable 'innodb_instrument_semaphores' can't be set to the value of 'NULL' -SET @@global.innodb_instrument_semaphores='junk'; -ERROR 42000: Variable 'innodb_instrument_semaphores' can't be set to the value of 'junk' - -# restore the initial value -SET @@global.innodb_instrument_semaphores = @innodb_instrument_semaphores_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores_basic.result b/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores_basic.result index dc8fba41e0b..561ddeb5a84 100644 --- a/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_instrument_semaphores_basic.result @@ -12,24 +12,34 @@ SELECT @@global.innodb_instrument_semaphores; SELECT @@session.innodb_instrument_semaphores; ERROR HY000: Variable 'innodb_instrument_semaphores' is a GLOBAL variable SET @@global.innodb_instrument_semaphores=OFF; +Warnings: +Warning 131 Using innodb_instrument_semaphores is deprecated and the parameter will be removed in MariaDB 10.3. SELECT @@global.innodb_instrument_semaphores; @@global.innodb_instrument_semaphores 0 SET @@global.innodb_instrument_semaphores=ON; +Warnings: +Warning 131 Using innodb_instrument_semaphores is deprecated and the parameter will be removed in MariaDB 10.3. SELECT @@global.innodb_instrument_semaphores; @@global.innodb_instrument_semaphores 1 # valid values SET @@global.innodb_instrument_semaphores='OFF'; +Warnings: +Warning 131 Using innodb_instrument_semaphores is deprecated and the parameter will be removed in MariaDB 10.3. SELECT @@global.innodb_instrument_semaphores; @@global.innodb_instrument_semaphores 0 SET @@global.innodb_instrument_semaphores=ON; +Warnings: +Warning 131 Using innodb_instrument_semaphores is deprecated and the parameter will be removed in MariaDB 10.3. SELECT @@global.innodb_instrument_semaphores; @@global.innodb_instrument_semaphores 1 SET @@global.innodb_instrument_semaphores=default; +Warnings: +Warning 131 Using innodb_instrument_semaphores is deprecated and the parameter will be removed in MariaDB 10.3. SELECT @@global.innodb_instrument_semaphores; @@global.innodb_instrument_semaphores 0 @@ -42,4 +52,6 @@ ERROR 42000: Variable 'innodb_instrument_semaphores' can't be set to the value o # restore the initial value SET @@global.innodb_instrument_semaphores = @innodb_instrument_semaphores_global_saved; +Warnings: +Warning 131 Using innodb_instrument_semaphores is deprecated and the parameter will be removed in MariaDB 10.3. # End of test diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result deleted file mode 100644 index ccd8e482756..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result +++ /dev/null @@ -1,616 +0,0 @@ -set global innodb_monitor_disable = All; -select name, status from information_schema.innodb_metrics; -name status -metadata_table_handles_opened disabled -metadata_table_handles_closed disabled -metadata_table_reference_count disabled -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -buffer_pool_size disabled -buffer_pool_reads disabled -buffer_pool_read_requests disabled -buffer_pool_write_requests disabled -buffer_pool_wait_free disabled -buffer_pool_read_ahead disabled -buffer_pool_read_ahead_evicted disabled -buffer_pool_pages_total disabled -buffer_pool_pages_misc disabled -buffer_pool_pages_data disabled -buffer_pool_bytes_data disabled -buffer_pool_pages_dirty disabled -buffer_pool_bytes_dirty disabled -buffer_pool_pages_free disabled -buffer_pages_created disabled -buffer_pages_written disabled -buffer_index_pages_written disabled -buffer_non_index_pages_written disabled -buffer_pages_read disabled -buffer_pages0_read disabled -buffer_index_sec_rec_cluster_reads disabled -buffer_index_sec_rec_cluster_reads_avoided disabled -buffer_data_reads disabled -buffer_data_written disabled -buffer_flush_batch_scanned disabled -buffer_flush_batch_num_scan disabled -buffer_flush_batch_scanned_per_call disabled -buffer_flush_batch_total_pages disabled -buffer_flush_batches disabled -buffer_flush_batch_pages disabled -buffer_flush_neighbor_total_pages disabled -buffer_flush_neighbor disabled -buffer_flush_neighbor_pages disabled -buffer_flush_n_to_flush_requested disabled -buffer_flush_n_to_flush_by_age disabled -buffer_flush_adaptive_avg_time_slot disabled -buffer_LRU_batch_flush_avg_time_slot disabled -buffer_flush_adaptive_avg_time_thread disabled -buffer_LRU_batch_flush_avg_time_thread disabled -buffer_flush_adaptive_avg_time_est disabled -buffer_LRU_batch_flush_avg_time_est disabled -buffer_flush_avg_time disabled -buffer_flush_adaptive_avg_pass disabled -buffer_LRU_batch_flush_avg_pass disabled -buffer_flush_avg_pass disabled -buffer_LRU_get_free_loops disabled -buffer_LRU_get_free_waits disabled -buffer_flush_avg_page_rate disabled -buffer_flush_lsn_avg_rate disabled -buffer_flush_pct_for_dirty disabled -buffer_flush_pct_for_lsn disabled -buffer_flush_sync_waits disabled -buffer_flush_adaptive_total_pages disabled -buffer_flush_adaptive disabled -buffer_flush_adaptive_pages disabled -buffer_flush_sync_total_pages disabled -buffer_flush_sync disabled -buffer_flush_sync_pages disabled -buffer_flush_background_total_pages disabled -buffer_flush_background disabled -buffer_flush_background_pages disabled -buffer_LRU_batch_scanned disabled -buffer_LRU_batch_num_scan disabled -buffer_LRU_batch_scanned_per_call disabled -buffer_LRU_batch_flush_total_pages disabled -buffer_LRU_batches_flush disabled -buffer_LRU_batch_flush_pages disabled -buffer_LRU_batch_evict_total_pages disabled -buffer_LRU_batches_evict disabled -buffer_LRU_batch_evict_pages disabled -buffer_LRU_single_flush_scanned disabled -buffer_LRU_single_flush_num_scan disabled -buffer_LRU_single_flush_scanned_per_call disabled -buffer_LRU_single_flush_failure_count disabled -buffer_LRU_get_free_search disabled -buffer_LRU_search_scanned disabled -buffer_LRU_search_num_scan disabled -buffer_LRU_search_scanned_per_call disabled -buffer_LRU_unzip_search_scanned disabled -buffer_LRU_unzip_search_num_scan disabled -buffer_LRU_unzip_search_scanned_per_call disabled -buffer_page_read_index_leaf disabled -buffer_page_read_index_non_leaf disabled -buffer_page_read_index_ibuf_leaf disabled -buffer_page_read_index_ibuf_non_leaf disabled -buffer_page_read_undo_log disabled -buffer_page_read_index_inode disabled -buffer_page_read_ibuf_free_list disabled -buffer_page_read_ibuf_bitmap disabled -buffer_page_read_system_page disabled -buffer_page_read_trx_system disabled -buffer_page_read_fsp_hdr disabled -buffer_page_read_xdes disabled -buffer_page_read_blob disabled -buffer_page_read_zblob disabled -buffer_page_read_zblob2 disabled -buffer_page_read_other disabled -buffer_page_written_index_leaf disabled -buffer_page_written_index_non_leaf disabled -buffer_page_written_index_ibuf_leaf disabled -buffer_page_written_index_ibuf_non_leaf disabled -buffer_page_written_undo_log disabled -buffer_page_written_index_inode disabled -buffer_page_written_ibuf_free_list disabled -buffer_page_written_ibuf_bitmap disabled -buffer_page_written_system_page disabled -buffer_page_written_trx_system disabled -buffer_page_written_fsp_hdr disabled -buffer_page_written_xdes disabled -buffer_page_written_blob disabled -buffer_page_written_zblob disabled -buffer_page_written_zblob2 disabled -buffer_page_written_other disabled -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs disabled -os_pending_reads disabled -os_pending_writes disabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs disabled -os_log_pending_writes disabled -trx_rw_commits disabled -trx_ro_commits disabled -trx_nl_ro_commits disabled -trx_commits_insert_update disabled -trx_rollbacks disabled -trx_rollbacks_savepoint disabled -trx_rollback_active disabled -trx_active_transactions disabled -trx_rseg_history_len disabled -trx_undo_slots_used disabled -trx_undo_slots_cached disabled -trx_rseg_current_size disabled -purge_del_mark_records disabled -purge_upd_exist_or_extern_records disabled -purge_invoked disabled -purge_undo_log_pages disabled -purge_dml_delay_usec disabled -purge_stop_count disabled -purge_resume_count disabled -log_checkpoints disabled -log_lsn_last_flush disabled -log_lsn_last_checkpoint disabled -log_lsn_current disabled -log_lsn_checkpoint_age disabled -log_lsn_buf_pool_oldest disabled -log_max_modified_age_async disabled -log_max_modified_age_sync disabled -log_pending_log_flushes disabled -log_pending_checkpoint_writes disabled -log_num_log_io disabled -log_waits disabled -log_write_requests disabled -log_writes disabled -log_padded disabled -compress_pages_compressed disabled -compress_pages_decompressed disabled -compression_pad_increments disabled -compression_pad_decrements disabled -compress_saved disabled -compress_pages_page_compressed disabled -compress_page_compressed_trim_op disabled -compress_pages_page_decompressed disabled -compress_pages_page_compression_error disabled -compress_pages_encrypted disabled -compress_pages_decrypted disabled -index_page_splits disabled -index_page_merge_attempts disabled -index_page_merge_successful disabled -index_page_reorg_attempts disabled -index_page_reorg_successful disabled -index_page_discards disabled -adaptive_hash_searches disabled -adaptive_hash_searches_btree disabled -adaptive_hash_pages_added disabled -adaptive_hash_pages_removed disabled -adaptive_hash_rows_added disabled -adaptive_hash_rows_removed disabled -adaptive_hash_rows_deleted_no_hash_entry disabled -adaptive_hash_rows_updated disabled -file_num_open_files disabled -ibuf_merges_insert disabled -ibuf_merges_delete_mark disabled -ibuf_merges_delete disabled -ibuf_merges_discard_insert disabled -ibuf_merges_discard_delete_mark disabled -ibuf_merges_discard_delete disabled -ibuf_merges disabled -ibuf_size disabled -innodb_master_thread_sleeps disabled -innodb_activity_count disabled -innodb_master_active_loops disabled -innodb_master_idle_loops disabled -innodb_background_drop_table_usec disabled -innodb_ibuf_merge_usec disabled -innodb_log_flush_usec disabled -innodb_mem_validate_usec disabled -innodb_master_purge_usec disabled -innodb_dict_lru_usec disabled -innodb_dict_lru_count_active disabled -innodb_dict_lru_count_idle disabled -innodb_checkpoint_usec disabled -innodb_dblwr_writes disabled -innodb_dblwr_pages_written disabled -innodb_page_size disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -dml_reads disabled -dml_inserts disabled -dml_deletes disabled -dml_updates disabled -dml_system_reads disabled -dml_system_inserts disabled -dml_system_deletes disabled -dml_system_updates disabled -ddl_background_drop_indexes disabled -ddl_background_drop_tables disabled -ddl_online_create_index disabled -ddl_pending_alter_table disabled -ddl_sort_file_alter_table disabled -ddl_log_file_alter_table disabled -icp_attempts disabled -icp_no_match disabled -icp_out_of_range disabled -icp_match disabled -set global innodb_monitor_enable = all; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_enable = aaa; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' -set global innodb_monitor_disable = All; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_reset_all = all; -select name from information_schema.innodb_metrics where count!=0; -name -set global innodb_monitor_enable = "%lock%"; -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); -name -set global innodb_monitor_disable = "%lock%"; -select name, status from information_schema.innodb_metrics -where name like "%lock%"; -name status -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -set global innodb_monitor_enable = "%lock*"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%%%%%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%_%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="log%%%%"; -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); -name -set global innodb_monitor_enable="os_%a_fs_ncs"; -set global innodb_monitor_enable="os%pending%"; -select name, status from information_schema.innodb_metrics -where name like "os%"; -name status -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs enabled -os_pending_reads enabled -os_pending_writes enabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs enabled -os_log_pending_writes enabled -set global innodb_monitor_enable=""; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' -set global innodb_monitor_enable="_"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' -SET global innodb_monitor_disable = module_metadata; -SET global innodb_monitor_reset_all = module_metadata; -set global innodb_monitor_enable = metadata_table_handles_opened; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_disable = metadata_table_handles_opened; -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = metadata_table_handles_opened; -drop table monitor_test; -create table monitor_test(col int) engine = innodb stats_persistent=0; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_enable = metadata_table_handles_closed; -create index idx on monitor_test(col); -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_metadata; -set global innodb_monitor_reset = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_reset_all = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = module_trx; -begin; -insert into monitor_test values(9); -commit; -begin; -insert into monitor_test values(9); -rollback; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; -name max_count min_count count max_count_reset min_count_reset count_reset status -trx_rollbacks 1 NULL 1 1 NULL 1 enabled -trx_active_transactions 1 0 0 1 0 0 enabled -set global innodb_monitor_disable = module_trx; -set global innodb_monitor_enable = module_dml; -insert into monitor_test values(9); -update monitor_test set col = 10 where col = 9; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 4 NULL 4 4 NULL 4 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 0 NULL 0 0 NULL 0 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 6 NULL 6 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 2 NULL 2 2 NULL 2 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 0 NULL 0 enabled -dml_inserts 1 NULL 1 0 NULL 0 enabled -dml_deletes 2 NULL 2 0 NULL 0 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_disable = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 disabled -dml_inserts 3 NULL 3 2 NULL 2 disabled -dml_deletes 4 NULL 4 2 NULL 2 disabled -dml_updates 2 NULL 2 0 NULL 0 disabled -dml_system_reads 0 NULL 0 0 NULL 0 disabled -dml_system_inserts 0 NULL 0 0 NULL 0 disabled -dml_system_deletes 0 NULL 0 0 NULL 0 disabled -dml_system_updates 0 NULL 0 0 NULL 0 disabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts NULL NULL 0 NULL NULL 0 disabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = dml_inserts; -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts 2 NULL 2 2 NULL 2 enabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_dml; -drop table monitor_test; -set global innodb_monitor_enable = file_num_open_files; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; -name max_count min_count count max_count_reset min_count_reset count_reset status -file_num_open_files # # # # # # enabled -set global innodb_monitor_disable = file_num_open_files; -set global innodb_monitor_enable = "icp%"; -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; -insert into monitor_test values("13", 2, "aa"); -select a from monitor_test where b < 1 for update; -a -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 1 -icp_no_match 0 -icp_out_of_range 1 -icp_match 0 -select a from monitor_test where b < 3 for update; -a -13 -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 2 -icp_no_match 0 -icp_out_of_range 1 -icp_match 1 -drop table monitor_test; -set global innodb_monitor_disable = All; -set global innodb_monitor_reset_all = all; -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result deleted file mode 100644 index ccd8e482756..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result +++ /dev/null @@ -1,616 +0,0 @@ -set global innodb_monitor_disable = All; -select name, status from information_schema.innodb_metrics; -name status -metadata_table_handles_opened disabled -metadata_table_handles_closed disabled -metadata_table_reference_count disabled -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -buffer_pool_size disabled -buffer_pool_reads disabled -buffer_pool_read_requests disabled -buffer_pool_write_requests disabled -buffer_pool_wait_free disabled -buffer_pool_read_ahead disabled -buffer_pool_read_ahead_evicted disabled -buffer_pool_pages_total disabled -buffer_pool_pages_misc disabled -buffer_pool_pages_data disabled -buffer_pool_bytes_data disabled -buffer_pool_pages_dirty disabled -buffer_pool_bytes_dirty disabled -buffer_pool_pages_free disabled -buffer_pages_created disabled -buffer_pages_written disabled -buffer_index_pages_written disabled -buffer_non_index_pages_written disabled -buffer_pages_read disabled -buffer_pages0_read disabled -buffer_index_sec_rec_cluster_reads disabled -buffer_index_sec_rec_cluster_reads_avoided disabled -buffer_data_reads disabled -buffer_data_written disabled -buffer_flush_batch_scanned disabled -buffer_flush_batch_num_scan disabled -buffer_flush_batch_scanned_per_call disabled -buffer_flush_batch_total_pages disabled -buffer_flush_batches disabled -buffer_flush_batch_pages disabled -buffer_flush_neighbor_total_pages disabled -buffer_flush_neighbor disabled -buffer_flush_neighbor_pages disabled -buffer_flush_n_to_flush_requested disabled -buffer_flush_n_to_flush_by_age disabled -buffer_flush_adaptive_avg_time_slot disabled -buffer_LRU_batch_flush_avg_time_slot disabled -buffer_flush_adaptive_avg_time_thread disabled -buffer_LRU_batch_flush_avg_time_thread disabled -buffer_flush_adaptive_avg_time_est disabled -buffer_LRU_batch_flush_avg_time_est disabled -buffer_flush_avg_time disabled -buffer_flush_adaptive_avg_pass disabled -buffer_LRU_batch_flush_avg_pass disabled -buffer_flush_avg_pass disabled -buffer_LRU_get_free_loops disabled -buffer_LRU_get_free_waits disabled -buffer_flush_avg_page_rate disabled -buffer_flush_lsn_avg_rate disabled -buffer_flush_pct_for_dirty disabled -buffer_flush_pct_for_lsn disabled -buffer_flush_sync_waits disabled -buffer_flush_adaptive_total_pages disabled -buffer_flush_adaptive disabled -buffer_flush_adaptive_pages disabled -buffer_flush_sync_total_pages disabled -buffer_flush_sync disabled -buffer_flush_sync_pages disabled -buffer_flush_background_total_pages disabled -buffer_flush_background disabled -buffer_flush_background_pages disabled -buffer_LRU_batch_scanned disabled -buffer_LRU_batch_num_scan disabled -buffer_LRU_batch_scanned_per_call disabled -buffer_LRU_batch_flush_total_pages disabled -buffer_LRU_batches_flush disabled -buffer_LRU_batch_flush_pages disabled -buffer_LRU_batch_evict_total_pages disabled -buffer_LRU_batches_evict disabled -buffer_LRU_batch_evict_pages disabled -buffer_LRU_single_flush_scanned disabled -buffer_LRU_single_flush_num_scan disabled -buffer_LRU_single_flush_scanned_per_call disabled -buffer_LRU_single_flush_failure_count disabled -buffer_LRU_get_free_search disabled -buffer_LRU_search_scanned disabled -buffer_LRU_search_num_scan disabled -buffer_LRU_search_scanned_per_call disabled -buffer_LRU_unzip_search_scanned disabled -buffer_LRU_unzip_search_num_scan disabled -buffer_LRU_unzip_search_scanned_per_call disabled -buffer_page_read_index_leaf disabled -buffer_page_read_index_non_leaf disabled -buffer_page_read_index_ibuf_leaf disabled -buffer_page_read_index_ibuf_non_leaf disabled -buffer_page_read_undo_log disabled -buffer_page_read_index_inode disabled -buffer_page_read_ibuf_free_list disabled -buffer_page_read_ibuf_bitmap disabled -buffer_page_read_system_page disabled -buffer_page_read_trx_system disabled -buffer_page_read_fsp_hdr disabled -buffer_page_read_xdes disabled -buffer_page_read_blob disabled -buffer_page_read_zblob disabled -buffer_page_read_zblob2 disabled -buffer_page_read_other disabled -buffer_page_written_index_leaf disabled -buffer_page_written_index_non_leaf disabled -buffer_page_written_index_ibuf_leaf disabled -buffer_page_written_index_ibuf_non_leaf disabled -buffer_page_written_undo_log disabled -buffer_page_written_index_inode disabled -buffer_page_written_ibuf_free_list disabled -buffer_page_written_ibuf_bitmap disabled -buffer_page_written_system_page disabled -buffer_page_written_trx_system disabled -buffer_page_written_fsp_hdr disabled -buffer_page_written_xdes disabled -buffer_page_written_blob disabled -buffer_page_written_zblob disabled -buffer_page_written_zblob2 disabled -buffer_page_written_other disabled -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs disabled -os_pending_reads disabled -os_pending_writes disabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs disabled -os_log_pending_writes disabled -trx_rw_commits disabled -trx_ro_commits disabled -trx_nl_ro_commits disabled -trx_commits_insert_update disabled -trx_rollbacks disabled -trx_rollbacks_savepoint disabled -trx_rollback_active disabled -trx_active_transactions disabled -trx_rseg_history_len disabled -trx_undo_slots_used disabled -trx_undo_slots_cached disabled -trx_rseg_current_size disabled -purge_del_mark_records disabled -purge_upd_exist_or_extern_records disabled -purge_invoked disabled -purge_undo_log_pages disabled -purge_dml_delay_usec disabled -purge_stop_count disabled -purge_resume_count disabled -log_checkpoints disabled -log_lsn_last_flush disabled -log_lsn_last_checkpoint disabled -log_lsn_current disabled -log_lsn_checkpoint_age disabled -log_lsn_buf_pool_oldest disabled -log_max_modified_age_async disabled -log_max_modified_age_sync disabled -log_pending_log_flushes disabled -log_pending_checkpoint_writes disabled -log_num_log_io disabled -log_waits disabled -log_write_requests disabled -log_writes disabled -log_padded disabled -compress_pages_compressed disabled -compress_pages_decompressed disabled -compression_pad_increments disabled -compression_pad_decrements disabled -compress_saved disabled -compress_pages_page_compressed disabled -compress_page_compressed_trim_op disabled -compress_pages_page_decompressed disabled -compress_pages_page_compression_error disabled -compress_pages_encrypted disabled -compress_pages_decrypted disabled -index_page_splits disabled -index_page_merge_attempts disabled -index_page_merge_successful disabled -index_page_reorg_attempts disabled -index_page_reorg_successful disabled -index_page_discards disabled -adaptive_hash_searches disabled -adaptive_hash_searches_btree disabled -adaptive_hash_pages_added disabled -adaptive_hash_pages_removed disabled -adaptive_hash_rows_added disabled -adaptive_hash_rows_removed disabled -adaptive_hash_rows_deleted_no_hash_entry disabled -adaptive_hash_rows_updated disabled -file_num_open_files disabled -ibuf_merges_insert disabled -ibuf_merges_delete_mark disabled -ibuf_merges_delete disabled -ibuf_merges_discard_insert disabled -ibuf_merges_discard_delete_mark disabled -ibuf_merges_discard_delete disabled -ibuf_merges disabled -ibuf_size disabled -innodb_master_thread_sleeps disabled -innodb_activity_count disabled -innodb_master_active_loops disabled -innodb_master_idle_loops disabled -innodb_background_drop_table_usec disabled -innodb_ibuf_merge_usec disabled -innodb_log_flush_usec disabled -innodb_mem_validate_usec disabled -innodb_master_purge_usec disabled -innodb_dict_lru_usec disabled -innodb_dict_lru_count_active disabled -innodb_dict_lru_count_idle disabled -innodb_checkpoint_usec disabled -innodb_dblwr_writes disabled -innodb_dblwr_pages_written disabled -innodb_page_size disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -dml_reads disabled -dml_inserts disabled -dml_deletes disabled -dml_updates disabled -dml_system_reads disabled -dml_system_inserts disabled -dml_system_deletes disabled -dml_system_updates disabled -ddl_background_drop_indexes disabled -ddl_background_drop_tables disabled -ddl_online_create_index disabled -ddl_pending_alter_table disabled -ddl_sort_file_alter_table disabled -ddl_log_file_alter_table disabled -icp_attempts disabled -icp_no_match disabled -icp_out_of_range disabled -icp_match disabled -set global innodb_monitor_enable = all; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_enable = aaa; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' -set global innodb_monitor_disable = All; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_reset_all = all; -select name from information_schema.innodb_metrics where count!=0; -name -set global innodb_monitor_enable = "%lock%"; -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); -name -set global innodb_monitor_disable = "%lock%"; -select name, status from information_schema.innodb_metrics -where name like "%lock%"; -name status -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -set global innodb_monitor_enable = "%lock*"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%%%%%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%_%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="log%%%%"; -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); -name -set global innodb_monitor_enable="os_%a_fs_ncs"; -set global innodb_monitor_enable="os%pending%"; -select name, status from information_schema.innodb_metrics -where name like "os%"; -name status -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs enabled -os_pending_reads enabled -os_pending_writes enabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs enabled -os_log_pending_writes enabled -set global innodb_monitor_enable=""; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' -set global innodb_monitor_enable="_"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' -SET global innodb_monitor_disable = module_metadata; -SET global innodb_monitor_reset_all = module_metadata; -set global innodb_monitor_enable = metadata_table_handles_opened; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_disable = metadata_table_handles_opened; -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = metadata_table_handles_opened; -drop table monitor_test; -create table monitor_test(col int) engine = innodb stats_persistent=0; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_enable = metadata_table_handles_closed; -create index idx on monitor_test(col); -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_metadata; -set global innodb_monitor_reset = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_reset_all = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = module_trx; -begin; -insert into monitor_test values(9); -commit; -begin; -insert into monitor_test values(9); -rollback; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; -name max_count min_count count max_count_reset min_count_reset count_reset status -trx_rollbacks 1 NULL 1 1 NULL 1 enabled -trx_active_transactions 1 0 0 1 0 0 enabled -set global innodb_monitor_disable = module_trx; -set global innodb_monitor_enable = module_dml; -insert into monitor_test values(9); -update monitor_test set col = 10 where col = 9; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 4 NULL 4 4 NULL 4 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 0 NULL 0 0 NULL 0 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 6 NULL 6 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 2 NULL 2 2 NULL 2 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 0 NULL 0 enabled -dml_inserts 1 NULL 1 0 NULL 0 enabled -dml_deletes 2 NULL 2 0 NULL 0 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_disable = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 disabled -dml_inserts 3 NULL 3 2 NULL 2 disabled -dml_deletes 4 NULL 4 2 NULL 2 disabled -dml_updates 2 NULL 2 0 NULL 0 disabled -dml_system_reads 0 NULL 0 0 NULL 0 disabled -dml_system_inserts 0 NULL 0 0 NULL 0 disabled -dml_system_deletes 0 NULL 0 0 NULL 0 disabled -dml_system_updates 0 NULL 0 0 NULL 0 disabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts NULL NULL 0 NULL NULL 0 disabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = dml_inserts; -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts 2 NULL 2 2 NULL 2 enabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_dml; -drop table monitor_test; -set global innodb_monitor_enable = file_num_open_files; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; -name max_count min_count count max_count_reset min_count_reset count_reset status -file_num_open_files # # # # # # enabled -set global innodb_monitor_disable = file_num_open_files; -set global innodb_monitor_enable = "icp%"; -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; -insert into monitor_test values("13", 2, "aa"); -select a from monitor_test where b < 1 for update; -a -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 1 -icp_no_match 0 -icp_out_of_range 1 -icp_match 0 -select a from monitor_test where b < 3 for update; -a -13 -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 2 -icp_no_match 0 -icp_out_of_range 1 -icp_match 1 -drop table monitor_test; -set global innodb_monitor_disable = All; -set global innodb_monitor_reset_all = all; -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; diff --git a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result deleted file mode 100644 index ccd8e482756..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result +++ /dev/null @@ -1,616 +0,0 @@ -set global innodb_monitor_disable = All; -select name, status from information_schema.innodb_metrics; -name status -metadata_table_handles_opened disabled -metadata_table_handles_closed disabled -metadata_table_reference_count disabled -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -buffer_pool_size disabled -buffer_pool_reads disabled -buffer_pool_read_requests disabled -buffer_pool_write_requests disabled -buffer_pool_wait_free disabled -buffer_pool_read_ahead disabled -buffer_pool_read_ahead_evicted disabled -buffer_pool_pages_total disabled -buffer_pool_pages_misc disabled -buffer_pool_pages_data disabled -buffer_pool_bytes_data disabled -buffer_pool_pages_dirty disabled -buffer_pool_bytes_dirty disabled -buffer_pool_pages_free disabled -buffer_pages_created disabled -buffer_pages_written disabled -buffer_index_pages_written disabled -buffer_non_index_pages_written disabled -buffer_pages_read disabled -buffer_pages0_read disabled -buffer_index_sec_rec_cluster_reads disabled -buffer_index_sec_rec_cluster_reads_avoided disabled -buffer_data_reads disabled -buffer_data_written disabled -buffer_flush_batch_scanned disabled -buffer_flush_batch_num_scan disabled -buffer_flush_batch_scanned_per_call disabled -buffer_flush_batch_total_pages disabled -buffer_flush_batches disabled -buffer_flush_batch_pages disabled -buffer_flush_neighbor_total_pages disabled -buffer_flush_neighbor disabled -buffer_flush_neighbor_pages disabled -buffer_flush_n_to_flush_requested disabled -buffer_flush_n_to_flush_by_age disabled -buffer_flush_adaptive_avg_time_slot disabled -buffer_LRU_batch_flush_avg_time_slot disabled -buffer_flush_adaptive_avg_time_thread disabled -buffer_LRU_batch_flush_avg_time_thread disabled -buffer_flush_adaptive_avg_time_est disabled -buffer_LRU_batch_flush_avg_time_est disabled -buffer_flush_avg_time disabled -buffer_flush_adaptive_avg_pass disabled -buffer_LRU_batch_flush_avg_pass disabled -buffer_flush_avg_pass disabled -buffer_LRU_get_free_loops disabled -buffer_LRU_get_free_waits disabled -buffer_flush_avg_page_rate disabled -buffer_flush_lsn_avg_rate disabled -buffer_flush_pct_for_dirty disabled -buffer_flush_pct_for_lsn disabled -buffer_flush_sync_waits disabled -buffer_flush_adaptive_total_pages disabled -buffer_flush_adaptive disabled -buffer_flush_adaptive_pages disabled -buffer_flush_sync_total_pages disabled -buffer_flush_sync disabled -buffer_flush_sync_pages disabled -buffer_flush_background_total_pages disabled -buffer_flush_background disabled -buffer_flush_background_pages disabled -buffer_LRU_batch_scanned disabled -buffer_LRU_batch_num_scan disabled -buffer_LRU_batch_scanned_per_call disabled -buffer_LRU_batch_flush_total_pages disabled -buffer_LRU_batches_flush disabled -buffer_LRU_batch_flush_pages disabled -buffer_LRU_batch_evict_total_pages disabled -buffer_LRU_batches_evict disabled -buffer_LRU_batch_evict_pages disabled -buffer_LRU_single_flush_scanned disabled -buffer_LRU_single_flush_num_scan disabled -buffer_LRU_single_flush_scanned_per_call disabled -buffer_LRU_single_flush_failure_count disabled -buffer_LRU_get_free_search disabled -buffer_LRU_search_scanned disabled -buffer_LRU_search_num_scan disabled -buffer_LRU_search_scanned_per_call disabled -buffer_LRU_unzip_search_scanned disabled -buffer_LRU_unzip_search_num_scan disabled -buffer_LRU_unzip_search_scanned_per_call disabled -buffer_page_read_index_leaf disabled -buffer_page_read_index_non_leaf disabled -buffer_page_read_index_ibuf_leaf disabled -buffer_page_read_index_ibuf_non_leaf disabled -buffer_page_read_undo_log disabled -buffer_page_read_index_inode disabled -buffer_page_read_ibuf_free_list disabled -buffer_page_read_ibuf_bitmap disabled -buffer_page_read_system_page disabled -buffer_page_read_trx_system disabled -buffer_page_read_fsp_hdr disabled -buffer_page_read_xdes disabled -buffer_page_read_blob disabled -buffer_page_read_zblob disabled -buffer_page_read_zblob2 disabled -buffer_page_read_other disabled -buffer_page_written_index_leaf disabled -buffer_page_written_index_non_leaf disabled -buffer_page_written_index_ibuf_leaf disabled -buffer_page_written_index_ibuf_non_leaf disabled -buffer_page_written_undo_log disabled -buffer_page_written_index_inode disabled -buffer_page_written_ibuf_free_list disabled -buffer_page_written_ibuf_bitmap disabled -buffer_page_written_system_page disabled -buffer_page_written_trx_system disabled -buffer_page_written_fsp_hdr disabled -buffer_page_written_xdes disabled -buffer_page_written_blob disabled -buffer_page_written_zblob disabled -buffer_page_written_zblob2 disabled -buffer_page_written_other disabled -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs disabled -os_pending_reads disabled -os_pending_writes disabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs disabled -os_log_pending_writes disabled -trx_rw_commits disabled -trx_ro_commits disabled -trx_nl_ro_commits disabled -trx_commits_insert_update disabled -trx_rollbacks disabled -trx_rollbacks_savepoint disabled -trx_rollback_active disabled -trx_active_transactions disabled -trx_rseg_history_len disabled -trx_undo_slots_used disabled -trx_undo_slots_cached disabled -trx_rseg_current_size disabled -purge_del_mark_records disabled -purge_upd_exist_or_extern_records disabled -purge_invoked disabled -purge_undo_log_pages disabled -purge_dml_delay_usec disabled -purge_stop_count disabled -purge_resume_count disabled -log_checkpoints disabled -log_lsn_last_flush disabled -log_lsn_last_checkpoint disabled -log_lsn_current disabled -log_lsn_checkpoint_age disabled -log_lsn_buf_pool_oldest disabled -log_max_modified_age_async disabled -log_max_modified_age_sync disabled -log_pending_log_flushes disabled -log_pending_checkpoint_writes disabled -log_num_log_io disabled -log_waits disabled -log_write_requests disabled -log_writes disabled -log_padded disabled -compress_pages_compressed disabled -compress_pages_decompressed disabled -compression_pad_increments disabled -compression_pad_decrements disabled -compress_saved disabled -compress_pages_page_compressed disabled -compress_page_compressed_trim_op disabled -compress_pages_page_decompressed disabled -compress_pages_page_compression_error disabled -compress_pages_encrypted disabled -compress_pages_decrypted disabled -index_page_splits disabled -index_page_merge_attempts disabled -index_page_merge_successful disabled -index_page_reorg_attempts disabled -index_page_reorg_successful disabled -index_page_discards disabled -adaptive_hash_searches disabled -adaptive_hash_searches_btree disabled -adaptive_hash_pages_added disabled -adaptive_hash_pages_removed disabled -adaptive_hash_rows_added disabled -adaptive_hash_rows_removed disabled -adaptive_hash_rows_deleted_no_hash_entry disabled -adaptive_hash_rows_updated disabled -file_num_open_files disabled -ibuf_merges_insert disabled -ibuf_merges_delete_mark disabled -ibuf_merges_delete disabled -ibuf_merges_discard_insert disabled -ibuf_merges_discard_delete_mark disabled -ibuf_merges_discard_delete disabled -ibuf_merges disabled -ibuf_size disabled -innodb_master_thread_sleeps disabled -innodb_activity_count disabled -innodb_master_active_loops disabled -innodb_master_idle_loops disabled -innodb_background_drop_table_usec disabled -innodb_ibuf_merge_usec disabled -innodb_log_flush_usec disabled -innodb_mem_validate_usec disabled -innodb_master_purge_usec disabled -innodb_dict_lru_usec disabled -innodb_dict_lru_count_active disabled -innodb_dict_lru_count_idle disabled -innodb_checkpoint_usec disabled -innodb_dblwr_writes disabled -innodb_dblwr_pages_written disabled -innodb_page_size disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -dml_reads disabled -dml_inserts disabled -dml_deletes disabled -dml_updates disabled -dml_system_reads disabled -dml_system_inserts disabled -dml_system_deletes disabled -dml_system_updates disabled -ddl_background_drop_indexes disabled -ddl_background_drop_tables disabled -ddl_online_create_index disabled -ddl_pending_alter_table disabled -ddl_sort_file_alter_table disabled -ddl_log_file_alter_table disabled -icp_attempts disabled -icp_no_match disabled -icp_out_of_range disabled -icp_match disabled -set global innodb_monitor_enable = all; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_enable = aaa; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of 'aaa' -set global innodb_monitor_disable = All; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_reset_all = all; -select name from information_schema.innodb_metrics where count!=0; -name -set global innodb_monitor_enable = "%lock%"; -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); -name -set global innodb_monitor_disable = "%lock%"; -select name, status from information_schema.innodb_metrics -where name like "%lock%"; -name status -lock_deadlocks disabled -lock_timeouts disabled -lock_rec_lock_waits disabled -lock_table_lock_waits disabled -lock_rec_lock_requests disabled -lock_rec_lock_created disabled -lock_rec_lock_removed disabled -lock_rec_locks disabled -lock_table_lock_created disabled -lock_table_lock_removed disabled -lock_table_locks disabled -lock_row_lock_current_waits disabled -lock_row_lock_time disabled -lock_row_lock_time_max disabled -lock_row_lock_waits disabled -lock_row_lock_time_avg disabled -innodb_rwlock_s_spin_waits disabled -innodb_rwlock_x_spin_waits disabled -innodb_rwlock_sx_spin_waits disabled -innodb_rwlock_s_spin_rounds disabled -innodb_rwlock_x_spin_rounds disabled -innodb_rwlock_sx_spin_rounds disabled -innodb_rwlock_s_os_waits disabled -innodb_rwlock_x_os_waits disabled -innodb_rwlock_sx_os_waits disabled -set global innodb_monitor_enable = "%lock*"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '%lock*' -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%%%%%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="%"; -select name from information_schema.innodb_metrics where status!='enabled'; -name -set global innodb_monitor_disable="%_%"; -select name from information_schema.innodb_metrics where status!='disabled'; -name -set global innodb_monitor_enable="log%%%%"; -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); -name -set global innodb_monitor_enable="os_%a_fs_ncs"; -set global innodb_monitor_enable="os%pending%"; -select name, status from information_schema.innodb_metrics -where name like "os%"; -name status -os_data_reads disabled -os_data_writes disabled -os_data_fsyncs enabled -os_pending_reads enabled -os_pending_writes enabled -os_log_bytes_written disabled -os_log_fsyncs disabled -os_log_pending_fsyncs enabled -os_log_pending_writes enabled -set global innodb_monitor_enable=""; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '' -set global innodb_monitor_enable="_"; -ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of '_' -SET global innodb_monitor_disable = module_metadata; -SET global innodb_monitor_reset_all = module_metadata; -set global innodb_monitor_enable = metadata_table_handles_opened; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 NULL NULL 0 enabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 1 NULL 1 enabled -set global innodb_monitor_disable = metadata_table_handles_opened; -set global innodb_monitor_reset = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -drop table monitor_test; -create table monitor_test(col int) engine = innodb; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -set global innodb_monitor_reset_all = metadata_table_handles_opened; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = metadata_table_handles_opened; -drop table monitor_test; -create table monitor_test(col int) engine = innodb stats_persistent=0; -select * from monitor_test; -col -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 1 NULL 1 1 NULL 1 enabled -set global innodb_monitor_enable = metadata_table_handles_closed; -create index idx on monitor_test(col); -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 2 NULL 2 enabled -metadata_table_handles_closed 1 NULL 1 1 NULL 1 enabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_metadata; -set global innodb_monitor_reset = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened 2 NULL 2 NULL NULL 0 disabled -metadata_table_handles_closed 1 NULL 1 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_reset_all = module_metadata; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -metadata_table_handles_opened NULL NULL 0 NULL NULL 0 disabled -metadata_table_handles_closed NULL NULL 0 NULL NULL 0 disabled -metadata_table_reference_count NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = module_trx; -begin; -insert into monitor_test values(9); -commit; -begin; -insert into monitor_test values(9); -rollback; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; -name max_count min_count count max_count_reset min_count_reset count_reset status -trx_rollbacks 1 NULL 1 1 NULL 1 enabled -trx_active_transactions 1 0 0 1 0 0 enabled -set global innodb_monitor_disable = module_trx; -set global innodb_monitor_enable = module_dml; -insert into monitor_test values(9); -update monitor_test set col = 10 where col = 9; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 4 NULL 4 4 NULL 4 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 0 NULL 0 0 NULL 0 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 6 NULL 6 enabled -dml_inserts 1 NULL 1 1 NULL 1 enabled -dml_deletes 2 NULL 2 2 NULL 2 enabled -dml_updates 2 NULL 2 2 NULL 2 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 0 NULL 0 enabled -dml_inserts 1 NULL 1 0 NULL 0 enabled -dml_deletes 2 NULL 2 0 NULL 0 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled -dml_inserts 3 NULL 3 2 NULL 2 enabled -dml_deletes 4 NULL 4 2 NULL 2 enabled -dml_updates 2 NULL 2 0 NULL 0 enabled -dml_system_reads 0 NULL 0 0 NULL 0 enabled -dml_system_inserts 0 NULL 0 0 NULL 0 enabled -dml_system_deletes 0 NULL 0 0 NULL 0 enabled -dml_system_updates 0 NULL 0 0 NULL 0 enabled -set global innodb_monitor_disable = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 disabled -dml_inserts 3 NULL 3 2 NULL 2 disabled -dml_deletes 4 NULL 4 2 NULL 2 disabled -dml_updates 2 NULL 2 0 NULL 0 disabled -dml_system_reads 0 NULL 0 0 NULL 0 disabled -dml_system_inserts 0 NULL 0 0 NULL 0 disabled -dml_system_deletes 0 NULL 0 0 NULL 0 disabled -dml_system_updates 0 NULL 0 0 NULL 0 disabled -set global innodb_monitor_reset_all = module_dml; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts NULL NULL 0 NULL NULL 0 disabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_enable = dml_inserts; -insert into monitor_test values(9); -insert into monitor_test values(1); -delete from monitor_test; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; -name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads NULL NULL 0 NULL NULL 0 disabled -dml_inserts 2 NULL 2 2 NULL 2 enabled -dml_deletes NULL NULL 0 NULL NULL 0 disabled -dml_updates NULL NULL 0 NULL NULL 0 disabled -dml_system_reads NULL NULL 0 NULL NULL 0 disabled -dml_system_inserts NULL NULL 0 NULL NULL 0 disabled -dml_system_deletes NULL NULL 0 NULL NULL 0 disabled -dml_system_updates NULL NULL 0 NULL NULL 0 disabled -set global innodb_monitor_disable = module_dml; -drop table monitor_test; -set global innodb_monitor_enable = file_num_open_files; -select name, max_count, min_count, count, -max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; -name max_count min_count count max_count_reset min_count_reset count_reset status -file_num_open_files # # # # # # enabled -set global innodb_monitor_disable = file_num_open_files; -set global innodb_monitor_enable = "icp%"; -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; -insert into monitor_test values("13", 2, "aa"); -select a from monitor_test where b < 1 for update; -a -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 1 -icp_no_match 0 -icp_out_of_range 1 -icp_match 0 -select a from monitor_test where b < 3 for update; -a -13 -select name, count from information_schema.innodb_metrics -where name like "icp%"; -name count -icp_attempts 2 -icp_no_match 0 -icp_out_of_range 1 -icp_match 1 -drop table monitor_test; -set global innodb_monitor_disable = All; -set global innodb_monitor_reset_all = all; -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; diff --git a/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result index 6ab0a19fb57..855bccad522 100644 --- a/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_use_trim_basic.result @@ -8,7 +8,7 @@ COUNT(@@GLOBAL.innodb_use_trim) 1 Expected SET @@GLOBAL.innodb_use_trim=1; Warnings: -Warning 131 Using innodb_use_trim is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html +Warning 131 Using innodb_use_trim is deprecated and the parameter will be removed in MariaDB 10.3. SELECT COUNT(@@GLOBAL.innodb_use_trim); COUNT(@@GLOBAL.innodb_use_trim) 1 @@ -31,7 +31,7 @@ COUNT(VARIABLE_VALUE) 1 Expected SET @@global.innodb_use_trim = @start_use_trim; Warnings: -Warning 131 Using innodb_use_trim is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html +Warning 131 Using innodb_use_trim is deprecated and the parameter will be removed in MariaDB 10.3. SELECT @@global.innodb_use_trim; @@global.innodb_use_trim 1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 62413546911..9bf02940d75 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -6,7 +6,7 @@ VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Number of InnoDB Adapative Hash Index Partitions. (default = 8). + VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 @@ -68,7 +68,7 @@ diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 9394692b526..a6a36ccf6d6 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -55,7 +55,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Number of InnoDB Adapative Hash Index Partitions. (default = 8). +VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 NUMERIC_BLOCK_SIZE 0 @@ -1301,7 +1301,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Enable semaphore request instrumentation. This could have some effect on performance but allows better information on long semaphore wait problems. (Default: not enabled) +VARIABLE_COMMENT DEPRECATED. This setting has no effect. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/t/innodb_monitor_enable_basic.test b/mysql-test/suite/sys_vars/t/innodb_monitor_enable_basic.test deleted file mode 100644 index 1b23ae14e49..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_monitor_enable_basic.test +++ /dev/null @@ -1,378 +0,0 @@ -# This is the test for Metrics Monitor Table feature. -# Test the metrics monitor system's control system -# and counter accuracy. - ---source include/have_innodb.inc -set global innodb_monitor_disable = All; -# Test turn on/off the monitor counter with "all" option -# By default, they will be off -select name, status from information_schema.innodb_metrics; - -# Turn on all monitor counters -set global innodb_monitor_enable = all; - -# status should all change to "enabled" -select name from information_schema.innodb_metrics where status!='enabled'; - -# Test wrong argument to the global configure option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = aaa; - -# We require a valid monitor counter/module name. There is no default -# counter name or module. A warning will be printed asking user to -# specify a valid counter name. -#--disable_warnings -#set global innodb_monitor_enable = default; -#--enable_warnings - -# Turn off all monitor counters, option name should be case -# insensitive -set global innodb_monitor_disable = All; - -# status should all change to "disabled" -select name from information_schema.innodb_metrics where status!='disabled'; - -# Reset all counter values -set global innodb_monitor_reset_all = all; - -# count should all change to 0 -select name from information_schema.innodb_metrics where count!=0; - -# Test wildcard match, turn on all counters contain string "lock" -set global innodb_monitor_enable = "%lock%"; - -# All lock related counter should be enabled -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); - -# Disable them -set global innodb_monitor_disable = "%lock%"; - -# All lock related counter should be disabled -select name, status from information_schema.innodb_metrics -where name like "%lock%"; - -# No match for "%lock*" ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = "%lock*"; - -# All counters will be turned on with wildcard match string with all "%" -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all counters -set global innodb_monitor_disable="%%%%%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# One more round testing. All counters will be turned on with -# single wildcard character "%" -set global innodb_monitor_enable="%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all the counters with "%_%" -set global innodb_monitor_disable="%_%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# Turn on all counters start with "log" -set global innodb_monitor_enable="log%%%%"; - -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); - -# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_" -# is single character wildcard match word -set global innodb_monitor_enable="os_%a_fs_ncs"; - -# Turn on counters whose name contains "os" and "pending" with -# wildcard match "os%pending%" -set global innodb_monitor_enable="os%pending%"; - -select name, status from information_schema.innodb_metrics -where name like "os%"; - -# Empty string is an invalid option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable=""; - ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable="_"; - -SET global innodb_monitor_disable = module_metadata; -SET global innodb_monitor_reset_all = module_metadata; - -# Only turn on "table_open" counter -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# This will open the monitor_test table -select * from monitor_test; - -# "metadata_table_handles_opened" should increment by 1 -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset the counter value while counter is still on (started) -# This will reset value "count_reset" but not -# "count" -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again to increment "metadata_table_handles_opened" again -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Cannot reset all monitor value while the counter is on -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn off the counter "metadata_table_handles_opened" -set global innodb_monitor_disable = metadata_table_handles_opened; - -# Reset the counter value while counter is off (disabled) -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again. Since monitor is off, "metadata_table_handles_opened" -# should not be incremented -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# "metadata_table_handles_opened" should increment -select * from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset all the counters, include those counter *_since_start -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn on "table_open" counter again -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Test metadata_table_handles_opened again to see if it is working correctly -# after above round of turning on/off/reset -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb stats_persistent=0; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Test counter "metadata_table_handles_closed", -# create index will close the old handle -set global innodb_monitor_enable = metadata_table_handles_closed; - -create index idx on monitor_test(col); - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Reset counters only in "module_metadata" module -set global innodb_monitor_disable = module_metadata; - -set global innodb_monitor_reset = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -set global innodb_monitor_reset_all = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Test Transaction Module -set global innodb_monitor_enable = module_trx; - -begin; -insert into monitor_test values(9); -commit; - -begin; -insert into monitor_test values(9); -rollback; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; - -set global innodb_monitor_disable = module_trx; - -# Test DML Module -set global innodb_monitor_enable = module_dml; - -insert into monitor_test values(9); - -update monitor_test set col = 10 where col = 9; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status - from information_schema.innodb_metrics - where name like "dml%"; - -# test reset counter while the counter is on -set global innodb_monitor_reset = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# insert/delete some rows after the reset -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# We do not allow reset_all while the counter is on, nothing -# should be reset here -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Turn off the counter -set global innodb_monitor_disable = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Reset all counter values -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Open individual counter "dml_inserts" -set global innodb_monitor_enable = dml_inserts; - -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -# Only counter "dml_inserts" should be updated -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -set global innodb_monitor_disable = module_dml; - -drop table monitor_test; - -set global innodb_monitor_enable = file_num_open_files; - -# Counters are unpredictable when innodb-file-per-table is on ---replace_column 2 # 3 # 4 # 5 # 6 # 7 # -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; - -set global innodb_monitor_disable = file_num_open_files; - -# Test ICP module counters -set global innodb_monitor_enable = "icp%"; - -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; - -insert into monitor_test values("13", 2, "aa"); - -select a from monitor_test where b < 1 for update; - -# should have icp_attempts = 1 and icp_out_of_range = 1 -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -# should have icp_attempts = 2 and icp_match = 1 -select a from monitor_test where b < 3 for update; - -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -drop table monitor_test; -set global innodb_monitor_disable = All; -set global innodb_monitor_reset_all = all; - --- disable_warnings -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; --- enable_warnings diff --git a/mysql-test/suite/sys_vars/t/innodb_monitor_reset_all_basic.test b/mysql-test/suite/sys_vars/t/innodb_monitor_reset_all_basic.test deleted file mode 100644 index 1b23ae14e49..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_monitor_reset_all_basic.test +++ /dev/null @@ -1,378 +0,0 @@ -# This is the test for Metrics Monitor Table feature. -# Test the metrics monitor system's control system -# and counter accuracy. - ---source include/have_innodb.inc -set global innodb_monitor_disable = All; -# Test turn on/off the monitor counter with "all" option -# By default, they will be off -select name, status from information_schema.innodb_metrics; - -# Turn on all monitor counters -set global innodb_monitor_enable = all; - -# status should all change to "enabled" -select name from information_schema.innodb_metrics where status!='enabled'; - -# Test wrong argument to the global configure option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = aaa; - -# We require a valid monitor counter/module name. There is no default -# counter name or module. A warning will be printed asking user to -# specify a valid counter name. -#--disable_warnings -#set global innodb_monitor_enable = default; -#--enable_warnings - -# Turn off all monitor counters, option name should be case -# insensitive -set global innodb_monitor_disable = All; - -# status should all change to "disabled" -select name from information_schema.innodb_metrics where status!='disabled'; - -# Reset all counter values -set global innodb_monitor_reset_all = all; - -# count should all change to 0 -select name from information_schema.innodb_metrics where count!=0; - -# Test wildcard match, turn on all counters contain string "lock" -set global innodb_monitor_enable = "%lock%"; - -# All lock related counter should be enabled -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); - -# Disable them -set global innodb_monitor_disable = "%lock%"; - -# All lock related counter should be disabled -select name, status from information_schema.innodb_metrics -where name like "%lock%"; - -# No match for "%lock*" ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = "%lock*"; - -# All counters will be turned on with wildcard match string with all "%" -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all counters -set global innodb_monitor_disable="%%%%%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# One more round testing. All counters will be turned on with -# single wildcard character "%" -set global innodb_monitor_enable="%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all the counters with "%_%" -set global innodb_monitor_disable="%_%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# Turn on all counters start with "log" -set global innodb_monitor_enable="log%%%%"; - -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); - -# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_" -# is single character wildcard match word -set global innodb_monitor_enable="os_%a_fs_ncs"; - -# Turn on counters whose name contains "os" and "pending" with -# wildcard match "os%pending%" -set global innodb_monitor_enable="os%pending%"; - -select name, status from information_schema.innodb_metrics -where name like "os%"; - -# Empty string is an invalid option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable=""; - ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable="_"; - -SET global innodb_monitor_disable = module_metadata; -SET global innodb_monitor_reset_all = module_metadata; - -# Only turn on "table_open" counter -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# This will open the monitor_test table -select * from monitor_test; - -# "metadata_table_handles_opened" should increment by 1 -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset the counter value while counter is still on (started) -# This will reset value "count_reset" but not -# "count" -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again to increment "metadata_table_handles_opened" again -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Cannot reset all monitor value while the counter is on -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn off the counter "metadata_table_handles_opened" -set global innodb_monitor_disable = metadata_table_handles_opened; - -# Reset the counter value while counter is off (disabled) -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again. Since monitor is off, "metadata_table_handles_opened" -# should not be incremented -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# "metadata_table_handles_opened" should increment -select * from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset all the counters, include those counter *_since_start -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn on "table_open" counter again -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Test metadata_table_handles_opened again to see if it is working correctly -# after above round of turning on/off/reset -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb stats_persistent=0; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Test counter "metadata_table_handles_closed", -# create index will close the old handle -set global innodb_monitor_enable = metadata_table_handles_closed; - -create index idx on monitor_test(col); - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Reset counters only in "module_metadata" module -set global innodb_monitor_disable = module_metadata; - -set global innodb_monitor_reset = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -set global innodb_monitor_reset_all = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Test Transaction Module -set global innodb_monitor_enable = module_trx; - -begin; -insert into monitor_test values(9); -commit; - -begin; -insert into monitor_test values(9); -rollback; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; - -set global innodb_monitor_disable = module_trx; - -# Test DML Module -set global innodb_monitor_enable = module_dml; - -insert into monitor_test values(9); - -update monitor_test set col = 10 where col = 9; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status - from information_schema.innodb_metrics - where name like "dml%"; - -# test reset counter while the counter is on -set global innodb_monitor_reset = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# insert/delete some rows after the reset -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# We do not allow reset_all while the counter is on, nothing -# should be reset here -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Turn off the counter -set global innodb_monitor_disable = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Reset all counter values -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Open individual counter "dml_inserts" -set global innodb_monitor_enable = dml_inserts; - -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -# Only counter "dml_inserts" should be updated -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -set global innodb_monitor_disable = module_dml; - -drop table monitor_test; - -set global innodb_monitor_enable = file_num_open_files; - -# Counters are unpredictable when innodb-file-per-table is on ---replace_column 2 # 3 # 4 # 5 # 6 # 7 # -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; - -set global innodb_monitor_disable = file_num_open_files; - -# Test ICP module counters -set global innodb_monitor_enable = "icp%"; - -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; - -insert into monitor_test values("13", 2, "aa"); - -select a from monitor_test where b < 1 for update; - -# should have icp_attempts = 1 and icp_out_of_range = 1 -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -# should have icp_attempts = 2 and icp_match = 1 -select a from monitor_test where b < 3 for update; - -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -drop table monitor_test; -set global innodb_monitor_disable = All; -set global innodb_monitor_reset_all = all; - --- disable_warnings -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; --- enable_warnings diff --git a/mysql-test/suite/sys_vars/t/innodb_monitor_reset_basic.test b/mysql-test/suite/sys_vars/t/innodb_monitor_reset_basic.test deleted file mode 100644 index 1b23ae14e49..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_monitor_reset_basic.test +++ /dev/null @@ -1,378 +0,0 @@ -# This is the test for Metrics Monitor Table feature. -# Test the metrics monitor system's control system -# and counter accuracy. - ---source include/have_innodb.inc -set global innodb_monitor_disable = All; -# Test turn on/off the monitor counter with "all" option -# By default, they will be off -select name, status from information_schema.innodb_metrics; - -# Turn on all monitor counters -set global innodb_monitor_enable = all; - -# status should all change to "enabled" -select name from information_schema.innodb_metrics where status!='enabled'; - -# Test wrong argument to the global configure option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = aaa; - -# We require a valid monitor counter/module name. There is no default -# counter name or module. A warning will be printed asking user to -# specify a valid counter name. -#--disable_warnings -#set global innodb_monitor_enable = default; -#--enable_warnings - -# Turn off all monitor counters, option name should be case -# insensitive -set global innodb_monitor_disable = All; - -# status should all change to "disabled" -select name from information_schema.innodb_metrics where status!='disabled'; - -# Reset all counter values -set global innodb_monitor_reset_all = all; - -# count should all change to 0 -select name from information_schema.innodb_metrics where count!=0; - -# Test wildcard match, turn on all counters contain string "lock" -set global innodb_monitor_enable = "%lock%"; - -# All lock related counter should be enabled -select name from information_schema.innodb_metrics -where status != IF(name like "%lock%", 'enabled', 'disabled'); - -# Disable them -set global innodb_monitor_disable = "%lock%"; - -# All lock related counter should be disabled -select name, status from information_schema.innodb_metrics -where name like "%lock%"; - -# No match for "%lock*" ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable = "%lock*"; - -# All counters will be turned on with wildcard match string with all "%" -set global innodb_monitor_enable="%%%%%%%%%%%%%%%%%%%%%%%%%%%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all counters -set global innodb_monitor_disable="%%%%%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# One more round testing. All counters will be turned on with -# single wildcard character "%" -set global innodb_monitor_enable="%"; - -select name from information_schema.innodb_metrics where status!='enabled'; - -# Turn off all the counters with "%_%" -set global innodb_monitor_disable="%_%"; - -select name from information_schema.innodb_metrics where status!='disabled'; - -# Turn on all counters start with "log" -set global innodb_monitor_enable="log%%%%"; - -select name from information_schema.innodb_metrics -where status != IF(name like "log%", 'enabled', 'disabled'); - -# Turn on counters "os_data_fsync" with wildcard match "os_%a_fs_ncs", "_" -# is single character wildcard match word -set global innodb_monitor_enable="os_%a_fs_ncs"; - -# Turn on counters whose name contains "os" and "pending" with -# wildcard match "os%pending%" -set global innodb_monitor_enable="os%pending%"; - -select name, status from information_schema.innodb_metrics -where name like "os%"; - -# Empty string is an invalid option ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable=""; - ---error ER_WRONG_VALUE_FOR_VAR -set global innodb_monitor_enable="_"; - -SET global innodb_monitor_disable = module_metadata; -SET global innodb_monitor_reset_all = module_metadata; - -# Only turn on "table_open" counter -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# This will open the monitor_test table -select * from monitor_test; - -# "metadata_table_handles_opened" should increment by 1 -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset the counter value while counter is still on (started) -# This will reset value "count_reset" but not -# "count" -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again to increment "metadata_table_handles_opened" again -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Cannot reset all monitor value while the counter is on -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn off the counter "metadata_table_handles_opened" -set global innodb_monitor_disable = metadata_table_handles_opened; - -# Reset the counter value while counter is off (disabled) -set global innodb_monitor_reset = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# re-create table again. Since monitor is off, "metadata_table_handles_opened" -# should not be incremented -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb; - -# "metadata_table_handles_opened" should increment -select * from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Reset all the counters, include those counter *_since_start -set global innodb_monitor_reset_all = metadata_table_handles_opened; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Turn on "table_open" counter again -set global innodb_monitor_enable = metadata_table_handles_opened; - -# Test metadata_table_handles_opened again to see if it is working correctly -# after above round of turning on/off/reset -drop table monitor_test; - -# Create a new table to test "metadata_table_handles_opened" counter -create table monitor_test(col int) engine = innodb stats_persistent=0; - -select * from monitor_test; - -# "metadata_table_handles_opened" should increment -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_opened"; - -# Test counter "metadata_table_handles_closed", -# create index will close the old handle -set global innodb_monitor_enable = metadata_table_handles_closed; - -create index idx on monitor_test(col); - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name = "metadata_table_handles_closed"; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Reset counters only in "module_metadata" module -set global innodb_monitor_disable = module_metadata; - -set global innodb_monitor_reset = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -set global innodb_monitor_reset_all = module_metadata; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "metadata%"; - -# Test Transaction Module -set global innodb_monitor_enable = module_trx; - -begin; -insert into monitor_test values(9); -commit; - -begin; -insert into monitor_test values(9); -rollback; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "trx_rollbacks" or name like "trx_active_transactions"; - -set global innodb_monitor_disable = module_trx; - -# Test DML Module -set global innodb_monitor_enable = module_dml; - -insert into monitor_test values(9); - -update monitor_test set col = 10 where col = 9; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status - from information_schema.innodb_metrics - where name like "dml%"; - -# test reset counter while the counter is on -set global innodb_monitor_reset = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# insert/delete some rows after the reset -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# We do not allow reset_all while the counter is on, nothing -# should be reset here -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Turn off the counter -set global innodb_monitor_disable = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Reset all counter values -set global innodb_monitor_reset_all = module_dml; - -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -# Open individual counter "dml_inserts" -set global innodb_monitor_enable = dml_inserts; - -insert into monitor_test values(9); -insert into monitor_test values(1); - -delete from monitor_test; - -# Only counter "dml_inserts" should be updated -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "dml%"; - -set global innodb_monitor_disable = module_dml; - -drop table monitor_test; - -set global innodb_monitor_enable = file_num_open_files; - -# Counters are unpredictable when innodb-file-per-table is on ---replace_column 2 # 3 # 4 # 5 # 6 # 7 # -select name, max_count, min_count, count, - max_count_reset, min_count_reset, count_reset, status -from information_schema.innodb_metrics -where name like "file_num_open_files"; - -set global innodb_monitor_disable = file_num_open_files; - -# Test ICP module counters -set global innodb_monitor_enable = "icp%"; - -create table monitor_test(a char(3), b int, c char(2), -primary key (a(1), c(1)), key(b)) engine = innodb; - -insert into monitor_test values("13", 2, "aa"); - -select a from monitor_test where b < 1 for update; - -# should have icp_attempts = 1 and icp_out_of_range = 1 -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -# should have icp_attempts = 2 and icp_match = 1 -select a from monitor_test where b < 3 for update; - -select name, count from information_schema.innodb_metrics -where name like "icp%"; - -drop table monitor_test; -set global innodb_monitor_disable = All; -set global innodb_monitor_reset_all = all; - --- disable_warnings -set global innodb_monitor_enable = default; -set global innodb_monitor_disable = default; -set global innodb_monitor_reset = default; -set global innodb_monitor_reset_all = default; --- enable_warnings diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index b3a127475f2..700111d5507 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -621,3 +621,24 @@ EXPLAIN EXTENDED WITH cte AS ( SELECT * FROM t1 ) SELECT i FROM cte; DROP TABLE t1; + +--echo # +--echo # MDEV-12185: view defintion contains WITH clause with +--echo # several specifications of CTE +--echo # + +with + alias1 as (select 1 as one), + alias2 as (select 2 as two) +select one, two from alias1, alias2; + +create view v1 as +with + alias1 as (select 1 as one), + alias2 as (select 2 as two) +select one, two from alias1, alias2; + +select * from v1; +show create view v1; + +drop view v1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 3475d325321..e5dd22c64c3 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -6071,5 +6071,22 @@ drop view v1; drop table t1; --echo # +--echo # MDEV-10704: Assertion `field->field->table == table_arg' +--echo # failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&, +--echo # bool, bool) +--echo # + +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +CREATE TABLE t3 (k INT); + +CREATE ALGORITHM = MERGE VIEW v AS SELECT j AS f1, k AS f2 FROM ( SELECT j FROM t1, t2 ) sq, t3; +--error ER_VIEW_MULTIUPDATE +REPLACE INTO v (f1,f2) VALUES (1,1); + +drop view v; +drop table t1,t2,t3; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 4d281b98d1c..c0622cd2cbf 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2013, Monty Program Ab +/* Copyright (c) 2011, 2017, MariaDB Corporation. Copyright (c) 2011, 2012, Oleksandr Byelkin Redistribution and use in source and binary forms, with or without @@ -74,15 +74,15 @@ uint32 copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, 2 bits which determinate size of offset in the header -1 */ /* mask to get above bits */ -#define DYNCOL_FLG_OFFSET (1|2) -#define DYNCOL_FLG_NAMES 4 -#define DYNCOL_FLG_NMOFFSET (8|16) +#define DYNCOL_FLG_OFFSET (1U|2U) +#define DYNCOL_FLG_NAMES 4U +#define DYNCOL_FLG_NMOFFSET (8U|16U) /** All known flags mask that could be set. @note DYNCOL_FLG_NMOFFSET should be 0 for now. */ -#define DYNCOL_FLG_KNOWN (1|2|4) +#define DYNCOL_FLG_KNOWN (1U|2U|4U) /* formats */ enum enum_dyncol_format @@ -294,7 +294,7 @@ static void set_fixed_header_named(DYNAMIC_COLUMN *str, DYN_HEADER *hdr) DBUG_ASSERT(hdr->offset_size <= MAX_OFFSET_LENGTH_NM); /* size of data offset, named format flag, size of names offset (0 means 2) */ str->str[0]= - (char) ((str->str[0] & ~(DYNCOL_FLG_OFFSET | DYNCOL_FLG_NMOFFSET)) | + (char) (((uchar)str->str[0] & ~(DYNCOL_FLG_OFFSET | DYNCOL_FLG_NMOFFSET)) | (hdr->offset_size - 2) | DYNCOL_FLG_NAMES); int2store(str->str + 1, hdr->column_count); /* columns number */ int2store(str->str + 3, hdr->nmpool_size); @@ -319,7 +319,7 @@ static my_bool type_and_offset_store_num(uchar *place, size_t offset_size, { ulong val = (((ulong) offset) << 3) | (type - 1); DBUG_ASSERT(type != DYN_COL_NULL); - DBUG_ASSERT(((type - 1) & (~7)) == 0); /* fit in 3 bits */ + DBUG_ASSERT(((type - 1) & (~7U)) == 0); /* fit in 3 bits */ DBUG_ASSERT(offset_size >= 1 && offset_size <= 4); /* Index entry starts with column number; jump over it */ @@ -359,7 +359,7 @@ static my_bool type_and_offset_store_named(uchar *place, size_t offset_size, { ulonglong val = (((ulong) offset) << 4) | (type - 1); DBUG_ASSERT(type != DYN_COL_NULL); - DBUG_ASSERT(((type - 1) & (~0xf)) == 0); /* fit in 4 bits */ + DBUG_ASSERT(((type - 1) & (~0xfU)) == 0); /* fit in 4 bits */ DBUG_ASSERT(offset_size >= 2 && offset_size <= 5); /* Index entry starts with name offset; jump over it */ diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 3077415b243..74eaa12f19d 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. + Copyright (c) 2017, 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 @@ -274,16 +275,16 @@ struct st_hash_link }; /* simple states of a block */ -#define BLOCK_ERROR 1 /* an error occurred when performing file i/o */ -#define BLOCK_READ 2 /* file block is in the block buffer */ -#define BLOCK_IN_SWITCH 4 /* block is preparing to read new page */ -#define BLOCK_REASSIGNED 8 /* blk does not accept requests for old page */ -#define BLOCK_IN_FLUSH 16 /* block is selected for flush */ -#define BLOCK_CHANGED 32 /* block buffer contains a dirty page */ -#define BLOCK_IN_USE 64 /* block is not free */ -#define BLOCK_IN_EVICTION 128 /* block is selected for eviction */ -#define BLOCK_IN_FLUSHWRITE 256 /* block is in write to file */ -#define BLOCK_FOR_UPDATE 512 /* block is selected for buffer modification */ +#define BLOCK_ERROR 1U/* an error occurred when performing file i/o */ +#define BLOCK_READ 2U/* file block is in the block buffer */ +#define BLOCK_IN_SWITCH 4U/* block is preparing to read new page */ +#define BLOCK_REASSIGNED 8U/* blk does not accept requests for old page */ +#define BLOCK_IN_FLUSH 16U/* block is selected for flush */ +#define BLOCK_CHANGED 32U/* block buffer contains a dirty page */ +#define BLOCK_IN_USE 64U/* block is not free */ +#define BLOCK_IN_EVICTION 128U/* block is selected for eviction */ +#define BLOCK_IN_FLUSHWRITE 256U/* block is in write to file */ +#define BLOCK_FOR_UPDATE 512U/* block is selected for buffer modification */ /* page status, returned by find_key_block */ #define PAGE_READ 0 diff --git a/mysys_ssl/yassl.cc b/mysys_ssl/yassl.cc index 9717870fe26..5146c9a9abc 100644 --- a/mysys_ssl/yassl.cc +++ b/mysys_ssl/yassl.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2015 MariaDB Corporation + Copyright (c) 2015, 2017, 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 @@ -27,9 +27,9 @@ using yaSSL::yaERR_remove_state; -#define EVP_CIPH_ECB_MODE 0x1 -#define EVP_CIPH_CBC_MODE 0x2 -#define EVP_CIPH_NO_PADDING 0x100 +#define EVP_CIPH_ECB_MODE 0x1U +#define EVP_CIPH_CBC_MODE 0x2U +#define EVP_CIPH_NO_PADDING 0x100U /* note that TaoCrypt::AES object is not explicitly put into EVP_CIPHER_CTX. diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 88f28e1d44a..5571b87e08a 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -1,6 +1,6 @@ /* Copyright (c) 2004, 2012, Oracle and/or its affiliates. - Copyright (c) 2010, 2013, Monty Program Ab. + Copyright (c) 2010, 2017, 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 @@ -1444,11 +1444,11 @@ MYSQL_TIME *unpack_time(longlong packed, MYSQL_TIME *my_time) if ((my_time->neg= packed < 0)) packed= -packed; get_one(my_time->second_part, 1000000ULL); - get_one(my_time->second, 60ULL); - get_one(my_time->minute, 60ULL); - get_one(my_time->hour, 24ULL); - get_one(my_time->day, 32ULL); - get_one(my_time->month, 13ULL); + get_one(my_time->second, 60U); + get_one(my_time->minute, 60U); + get_one(my_time->hour, 24U); + get_one(my_time->day, 32U); + get_one(my_time->month, 13U); my_time->year= (uint)packed; my_time->time_type= MYSQL_TIMESTAMP_DATETIME; return my_time; diff --git a/sql/create_options.cc b/sql/create_options.cc index 40382c7887e..7edc2cb95f2 100644 --- a/sql/create_options.cc +++ b/sql/create_options.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Monty Program Ab +/* Copyright (C) 2010, 2017, MariaDB Corporation Ab 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 @@ -23,7 +23,7 @@ #include <my_getopt.h> #include "set_var.h" -#define FRM_QUOTED_VALUE 0x8000 +#define FRM_QUOTED_VALUE 0x8000U /** Links this item to the given list end diff --git a/sql/field.h b/sql/field.h index 77556416465..63f7d1fa57d 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1,7 +1,7 @@ #ifndef FIELD_INCLUDED #define FIELD_INCLUDED /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2008, 2015, MariaDB + Copyright (c) 2008, 2017, 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 @@ -1019,7 +1019,7 @@ public: virtual int cmp_max(const uchar *a, const uchar *b, uint max_len) { return cmp(a, b); } virtual int cmp(const uchar *,const uchar *)=0; - virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L) + virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) { return memcmp(a,b,pack_length()); } virtual int cmp_offset(uint row_offset) { return cmp(ptr,ptr+row_offset); } @@ -1370,7 +1370,8 @@ public: void set_storage_type(ha_storage_media storage_type_arg) { DBUG_ASSERT(field_storage_type() == HA_SM_DEFAULT); - flags |= (storage_type_arg << FIELD_FLAGS_STORAGE_MEDIA); + flags |= static_cast<uint32>(storage_type_arg) << + FIELD_FLAGS_STORAGE_MEDIA; } column_format_type column_format() const @@ -1382,7 +1383,8 @@ public: void set_column_format(column_format_type column_format_arg) { DBUG_ASSERT(column_format() == COLUMN_FORMAT_TYPE_DEFAULT); - flags |= (column_format_arg << FIELD_FLAGS_COLUMN_FORMAT); + flags |= static_cast<uint32>(column_format_arg) << + FIELD_FLAGS_COLUMN_FORMAT; } /* @@ -3131,7 +3133,7 @@ public: int cmp_max(const uchar *, const uchar *, uint max_length); int cmp(const uchar *a,const uchar *b) { - return cmp_max(a, b, ~0L); + return cmp_max(a, b, ~0U); } void sort_string(uchar *buff,uint length); uint get_key_image(uchar *buff,uint length, imagetype type); @@ -3140,7 +3142,7 @@ public: virtual uchar *pack(uchar *to, const uchar *from, uint max_length); virtual const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, uint param_data); - int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L); + int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U); int key_cmp(const uchar *,const uchar*); int key_cmp(const uchar *str, uint length); uint packed_col_length(const uchar *to, uint length); @@ -3250,9 +3252,9 @@ public: my_decimal *val_decimal(my_decimal *); int cmp_max(const uchar *, const uchar *, uint max_length); int cmp(const uchar *a,const uchar *b) - { return cmp_max(a, b, ~0L); } + { return cmp_max(a, b, ~0U); } int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length); - int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L); + int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U); int key_cmp(const uchar *,const uchar*); int key_cmp(const uchar *str, uint length); /* Never update the value of min_val for a blob field */ @@ -3878,7 +3880,7 @@ public: bool sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root); - bool prepare_create_field(uint *blob_columns, longlong table_flags); + bool prepare_create_field(uint *blob_columns, ulonglong table_flags); bool check(THD *thd); @@ -4028,26 +4030,26 @@ bool check_expression(Virtual_column_info *vcol, const char *name, The following are for the interface with the .frm file */ -#define FIELDFLAG_DECIMAL 1 -#define FIELDFLAG_BINARY 1 // Shares same flag -#define FIELDFLAG_NUMBER 2 -#define FIELDFLAG_ZEROFILL 4 -#define FIELDFLAG_PACK 120 // Bits used for packing -#define FIELDFLAG_INTERVAL 256 // mangled with decimals! -#define FIELDFLAG_BITFIELD 512 // mangled with decimals! -#define FIELDFLAG_BLOB 1024 // mangled with decimals! -#define FIELDFLAG_GEOM 2048 // mangled with decimals! - -#define FIELDFLAG_TREAT_BIT_AS_CHAR 4096 /* use Field_bit_as_char */ -#define FIELDFLAG_LONG_DECIMAL 8192 -#define FIELDFLAG_NO_DEFAULT 16384 /* sql */ -#define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql -#define FIELDFLAG_HEX_ESCAPE ((uint) 0x10000) +#define FIELDFLAG_DECIMAL 1U +#define FIELDFLAG_BINARY 1U // Shares same flag +#define FIELDFLAG_NUMBER 2U +#define FIELDFLAG_ZEROFILL 4U +#define FIELDFLAG_PACK 120U // Bits used for packing +#define FIELDFLAG_INTERVAL 256U // mangled with decimals! +#define FIELDFLAG_BITFIELD 512U // mangled with decimals! +#define FIELDFLAG_BLOB 1024U // mangled with decimals! +#define FIELDFLAG_GEOM 2048U // mangled with decimals! + +#define FIELDFLAG_TREAT_BIT_AS_CHAR 4096U /* use Field_bit_as_char */ +#define FIELDFLAG_LONG_DECIMAL 8192U +#define FIELDFLAG_NO_DEFAULT 16384U /* sql */ +#define FIELDFLAG_MAYBE_NULL 32768U // sql +#define FIELDFLAG_HEX_ESCAPE 0x10000U #define FIELDFLAG_PACK_SHIFT 3 #define FIELDFLAG_DEC_SHIFT 8 -#define FIELDFLAG_MAX_DEC 63 +#define FIELDFLAG_MAX_DEC 63U -#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */ +#define MTYP_TYPENR(type) (type & 127U) /* Remove bits from type */ #define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL) #define f_is_num(x) ((x) & FIELDFLAG_NUMBER) @@ -4061,7 +4063,7 @@ bool check_expression(Virtual_column_info *vcol, const char *name, #define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) #define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM) -#define f_settype(x) (((int) (x)) << FIELDFLAG_PACK_SHIFT) +#define f_settype(x) (((uint) (x)) << FIELDFLAG_PACK_SHIFT) #define f_maybe_null(x) ((x) & FIELDFLAG_MAYBE_NULL) #define f_no_default(x) ((x) & FIELDFLAG_NO_DEFAULT) #define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR) diff --git a/sql/handler.h b/sql/handler.h index 3e04cf7f7b5..0caa5f7c181 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2,7 +2,7 @@ #define HANDLER_INCLUDED /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB + Copyright (c) 2009, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -236,12 +236,12 @@ enum enum_alter_inplace_result { @note This optimization in combination with batching may be used to remove even more roundtrips. */ -#define HA_READ_BEFORE_WRITE_REMOVAL (1LL << 43) +#define HA_READ_BEFORE_WRITE_REMOVAL (1ULL << 43) /* Engine supports extended fulltext API */ -#define HA_CAN_FULLTEXT_EXT (1LL << 44) +#define HA_CAN_FULLTEXT_EXT (1ULL << 44) /* Storage engine supports table export using the @@ -249,7 +249,7 @@ enum enum_alter_inplace_result { (meaning, after this statement one can copy table files out of the datadir and later "import" (somehow) in another MariaDB instance) */ -#define HA_CAN_EXPORT (1LL << 45) +#define HA_CAN_EXPORT (1ULL << 45) /* Storage engine does not require an exclusive metadata lock @@ -259,7 +259,7 @@ enum enum_alter_inplace_result { read or modify the table - this is defined by THR locks and the ::store_lock() method). */ -#define HA_CONCURRENT_OPTIMIZE (1LL << 46) +#define HA_CONCURRENT_OPTIMIZE (1ULL << 46) /* Set of all binlog flags. Currently only contain the capabilities @@ -298,24 +298,24 @@ enum enum_alter_inplace_result { Partitioning needs both ADD and DROP to be supported by its underlying handlers, due to error handling, see bug#57778. */ -#define HA_INPLACE_ADD_INDEX_NO_READ_WRITE (1L << 0) -#define HA_INPLACE_DROP_INDEX_NO_READ_WRITE (1L << 1) -#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE (1L << 2) -#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE (1L << 3) -#define HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE (1L << 4) -#define HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE (1L << 5) +#define HA_INPLACE_ADD_INDEX_NO_READ_WRITE (1UL << 0) +#define HA_INPLACE_DROP_INDEX_NO_READ_WRITE (1UL << 1) +#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE (1UL << 2) +#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE (1UL << 3) +#define HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE (1UL << 4) +#define HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE (1UL << 5) /* These are set if different kinds of indexes can be created or dropped in-place while still allowing concurrent reads (but not writes) of table data. If a handler is capable of one or more of these, it should also set the corresponding *_NO_READ_WRITE bit(s). */ -#define HA_INPLACE_ADD_INDEX_NO_WRITE (1L << 6) -#define HA_INPLACE_DROP_INDEX_NO_WRITE (1L << 7) -#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE (1L << 8) -#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1L << 9) -#define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1L << 10) -#define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1L << 11) +#define HA_INPLACE_ADD_INDEX_NO_WRITE (1UL << 6) +#define HA_INPLACE_DROP_INDEX_NO_WRITE (1UL << 7) +#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE (1UL << 8) +#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1UL << 9) +#define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1UL << 10) +#define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1UL << 11) /* HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is supported at all. @@ -341,9 +341,9 @@ enum enum_alter_inplace_result { the storage engine. A typical engine to support this is NDB (through WL #2498). */ -#define HA_PARTITION_FUNCTION_SUPPORTED (1L << 12) -#define HA_FAST_CHANGE_PARTITION (1L << 13) -#define HA_PARTITION_ONE_PHASE (1L << 14) +#define HA_PARTITION_FUNCTION_SUPPORTED (1UL << 12) +#define HA_FAST_CHANGE_PARTITION (1UL << 13) +#define HA_PARTITION_ONE_PHASE (1UL << 14) /* operations for disable/enable indexes */ #define HA_KEY_SWITCH_NONUNIQ 0 @@ -369,25 +369,25 @@ enum enum_alter_inplace_result { HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */ -#define HA_OPEN_KEYFILE 1 -#define HA_READ_ONLY 16 /* File opened as readonly */ +#define HA_OPEN_KEYFILE 1U +#define HA_READ_ONLY 16U /* File opened as readonly */ /* Try readonly if can't open with read and write */ -#define HA_TRY_READ_ONLY 32 +#define HA_TRY_READ_ONLY 32U /* Some key definitions */ #define HA_KEY_NULL_LENGTH 1 #define HA_KEY_BLOB_LENGTH 2 -#define HA_LEX_CREATE_TMP_TABLE 1 -#define HA_CREATE_TMP_ALTER 8 +#define HA_LEX_CREATE_TMP_TABLE 1U +#define HA_CREATE_TMP_ALTER 8U #define HA_MAX_REC_LENGTH 65535 /* Table caching type */ #define HA_CACHE_TBL_NONTRANSACT 0 -#define HA_CACHE_TBL_NOCACHE 1 -#define HA_CACHE_TBL_ASKTRANSACT 2 -#define HA_CACHE_TBL_TRANSACT 4 +#define HA_CACHE_TBL_NOCACHE 1U +#define HA_CACHE_TBL_ASKTRANSACT 2U +#define HA_CACHE_TBL_TRANSACT 4U /** Options for the START TRANSACTION statement. @@ -409,9 +409,9 @@ static const uint MYSQL_START_TRANS_OPT_READ_ONLY = 2; static const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4; /* Flags for method is_fatal_error */ -#define HA_CHECK_DUP_KEY 1 -#define HA_CHECK_DUP_UNIQUE 2 -#define HA_CHECK_FK_ERROR 4 +#define HA_CHECK_DUP_KEY 1U +#define HA_CHECK_DUP_UNIQUE 2U +#define HA_CHECK_FK_ERROR 4U #define HA_CHECK_DUP (HA_CHECK_DUP_KEY + HA_CHECK_DUP_UNIQUE) #define HA_CHECK_ALL (~0U) @@ -478,49 +478,49 @@ enum enum_binlog_command { /* struct to hold information about the table that should be created */ /* Bits in used_fields */ -#define HA_CREATE_USED_AUTO (1L << 0) -#define HA_CREATE_USED_RAID (1L << 1) //RAID is no longer availble -#define HA_CREATE_USED_UNION (1L << 2) -#define HA_CREATE_USED_INSERT_METHOD (1L << 3) -#define HA_CREATE_USED_MIN_ROWS (1L << 4) -#define HA_CREATE_USED_MAX_ROWS (1L << 5) -#define HA_CREATE_USED_AVG_ROW_LENGTH (1L << 6) -#define HA_CREATE_USED_PACK_KEYS (1L << 7) -#define HA_CREATE_USED_CHARSET (1L << 8) -#define HA_CREATE_USED_DEFAULT_CHARSET (1L << 9) -#define HA_CREATE_USED_DATADIR (1L << 10) -#define HA_CREATE_USED_INDEXDIR (1L << 11) -#define HA_CREATE_USED_ENGINE (1L << 12) -#define HA_CREATE_USED_CHECKSUM (1L << 13) -#define HA_CREATE_USED_DELAY_KEY_WRITE (1L << 14) -#define HA_CREATE_USED_ROW_FORMAT (1L << 15) -#define HA_CREATE_USED_COMMENT (1L << 16) -#define HA_CREATE_USED_PASSWORD (1L << 17) -#define HA_CREATE_USED_CONNECTION (1L << 18) -#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19) +#define HA_CREATE_USED_AUTO (1UL << 0) +#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer availble +#define HA_CREATE_USED_UNION (1UL << 2) +#define HA_CREATE_USED_INSERT_METHOD (1UL << 3) +#define HA_CREATE_USED_MIN_ROWS (1UL << 4) +#define HA_CREATE_USED_MAX_ROWS (1UL << 5) +#define HA_CREATE_USED_AVG_ROW_LENGTH (1UL << 6) +#define HA_CREATE_USED_PACK_KEYS (1UL << 7) +#define HA_CREATE_USED_CHARSET (1UL << 8) +#define HA_CREATE_USED_DEFAULT_CHARSET (1UL << 9) +#define HA_CREATE_USED_DATADIR (1UL << 10) +#define HA_CREATE_USED_INDEXDIR (1UL << 11) +#define HA_CREATE_USED_ENGINE (1UL << 12) +#define HA_CREATE_USED_CHECKSUM (1UL << 13) +#define HA_CREATE_USED_DELAY_KEY_WRITE (1UL << 14) +#define HA_CREATE_USED_ROW_FORMAT (1UL << 15) +#define HA_CREATE_USED_COMMENT (1UL << 16) +#define HA_CREATE_USED_PASSWORD (1UL << 17) +#define HA_CREATE_USED_CONNECTION (1UL << 18) +#define HA_CREATE_USED_KEY_BLOCK_SIZE (1UL << 19) /* The following two are used by Maria engine: */ -#define HA_CREATE_USED_TRANSACTIONAL (1L << 20) -#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21) +#define HA_CREATE_USED_TRANSACTIONAL (1UL << 20) +#define HA_CREATE_USED_PAGE_CHECKSUM (1UL << 21) /** This is set whenever STATS_PERSISTENT=0|1|default has been specified in CREATE/ALTER TABLE. See also HA_OPTION_STATS_PERSISTENT in include/my_base.h. It is possible to distinguish whether STATS_PERSISTENT=default has been specified or no STATS_PERSISTENT= is given at all. */ -#define HA_CREATE_USED_STATS_PERSISTENT (1L << 22) +#define HA_CREATE_USED_STATS_PERSISTENT (1UL << 22) /** This is set whenever STATS_AUTO_RECALC=0|1|default has been specified in CREATE/ALTER TABLE. See enum_stats_auto_recalc. It is possible to distinguish whether STATS_AUTO_RECALC=default has been specified or no STATS_AUTO_RECALC= is given at all. */ -#define HA_CREATE_USED_STATS_AUTO_RECALC (1L << 23) +#define HA_CREATE_USED_STATS_AUTO_RECALC (1UL << 23) /** This is set whenever STATS_SAMPLE_PAGES=N|default has been specified in CREATE/ALTER TABLE. It is possible to distinguish whether STATS_SAMPLE_PAGES=default has been specified or no STATS_SAMPLE_PAGES= is given at all. */ -#define HA_CREATE_USED_STATS_SAMPLE_PAGES (1L << 24) +#define HA_CREATE_USED_STATS_SAMPLE_PAGES (1UL << 24) /* @@ -614,8 +614,7 @@ struct xid_t { } uint length() { - return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+ - gtrid_length+bqual_length; + return static_cast<uint>(sizeof(formatID)) + key_length(); } uchar *key() const { @@ -623,7 +622,8 @@ struct xid_t { } uint key_length() const { - return sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length; + return static_cast<uint>(sizeof(gtrid_length)+sizeof(bqual_length)+ + gtrid_length+bqual_length); } }; typedef struct xid_t XID; @@ -2332,12 +2332,13 @@ public: /** Whether or not all costs in the object are zero - + @return true if all costs are zero, false otherwise */ bool is_zero() const - { - return !(io_count || cpu_cost || import_cost || mem_cost); + { + return io_count == 0.0 && cpu_cost == 0.0 && + import_cost == 0.0 && mem_cost == 0.0; } void reset() @@ -2402,29 +2403,29 @@ void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, The ranges may not use the full key but all of them will use the same number of key parts. */ -#define HA_MRR_SINGLE_POINT 1 -#define HA_MRR_FIXED_KEY 2 +#define HA_MRR_SINGLE_POINT 1U +#define HA_MRR_FIXED_KEY 2U /* Indicates that RANGE_SEQ_IF::next(&range) doesn't need to fill in the 'range' parameter. */ -#define HA_MRR_NO_ASSOCIATION 4 +#define HA_MRR_NO_ASSOCIATION 4U /* The MRR user will provide ranges in key order, and MRR implementation must return rows in key order. */ -#define HA_MRR_SORTED 8 +#define HA_MRR_SORTED 8U /* MRR implementation doesn't have to retrieve full records */ -#define HA_MRR_INDEX_ONLY 16 +#define HA_MRR_INDEX_ONLY 16U /* The passed memory buffer is of maximum possible size, the caller can't assume larger buffer. */ -#define HA_MRR_LIMITS 32 +#define HA_MRR_LIMITS 32U /* @@ -2433,14 +2434,14 @@ void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, flag. SQL layer remembers the flag value and then passes it to multi_read_range_init(). */ -#define HA_MRR_USE_DEFAULT_IMPL 64 +#define HA_MRR_USE_DEFAULT_IMPL 64U /* Used only as parameter to multi_range_read_info(): Flag set <=> the caller guarantees that the bounds of the scanned ranges will not have NULL values. */ -#define HA_MRR_NO_NULL_ENDPOINTS 128 +#define HA_MRR_NO_NULL_ENDPOINTS 128U /* The MRR user has materialized range keys somewhere in the user's buffer. @@ -2451,7 +2452,7 @@ void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, pointer in range->start_key.key will point to a key value that will remain there until the end of the MRR scan. */ -#define HA_MRR_MATERIALIZED_KEYS 256 +#define HA_MRR_MATERIALIZED_KEYS 256U /* The following bits are reserved for use by MRR implementation. The intended @@ -2469,15 +2470,15 @@ void get_sweep_read_cost(TABLE *table, ha_rows nrows, bool interrupted, handler->multi_range_read_explain_info(mrr_mode) to get a text description of the picked MRR scan; the description will be a part of EXPLAIN output. */ -#define HA_MRR_IMPLEMENTATION_FLAG1 512 -#define HA_MRR_IMPLEMENTATION_FLAG2 1024 -#define HA_MRR_IMPLEMENTATION_FLAG3 2048 -#define HA_MRR_IMPLEMENTATION_FLAG4 4096 -#define HA_MRR_IMPLEMENTATION_FLAG5 8192 -#define HA_MRR_IMPLEMENTATION_FLAG6 16384 +#define HA_MRR_IMPLEMENTATION_FLAG1 512U +#define HA_MRR_IMPLEMENTATION_FLAG2 1024U +#define HA_MRR_IMPLEMENTATION_FLAG3 2048U +#define HA_MRR_IMPLEMENTATION_FLAG4 4096U +#define HA_MRR_IMPLEMENTATION_FLAG5 8192U +#define HA_MRR_IMPLEMENTATION_FLAG6 16384U #define HA_MRR_IMPLEMENTATION_FLAGS \ - (512 | 1024 | 2048 | 4096 | 8192 | 16384) + (512U | 1024U | 2048U | 4096U | 8192U | 16384U) /* This is a buffer area that the handler can use to store rows. diff --git a/sql/item.h b/sql/item.h index 3908fe20aa1..1c8c5e99426 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2,7 +2,7 @@ #define SQL_ITEM_INCLUDED /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB + Copyright (c) 2009, 2017, 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 @@ -96,6 +96,13 @@ enum precedence { typedef Bounds_checked_array<Item*> Ref_ptr_array; +static inline uint32 +char_to_byte_length_safe(size_t char_length_arg, uint32 mbmaxlen_arg) +{ + ulonglong tmp= ((ulonglong) char_length_arg) * mbmaxlen_arg; + return tmp > UINT_MAX32 ? UINT_MAX32 : static_cast<uint32>(tmp); +} + bool mark_unsupported_function(const char *where, void *store, uint result); /* convenience helper for mark_unsupported_function() above */ @@ -403,7 +410,7 @@ class Copy_query_with_rewrite bool copy_up_to(size_t bytes) { DBUG_ASSERT(bytes >= from); - return dst->append(src + from, bytes - from); + return dst->append(src + from, uint32(bytes - from)); } public: @@ -1694,6 +1701,16 @@ public: bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs); bool too_big_for_varchar() const { return max_char_length() > CONVERT_IF_BIGGER_TO_BLOB; } + void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs) + { + max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen); + collation.collation= cs; + } + void fix_char_length(size_t max_char_length_arg) + { + max_length= char_to_byte_length_safe(max_char_length_arg, + collation.collation->mbmaxlen); + } /* Return TRUE if the item points to a column of an outer-joined table. */ diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 07755d6b434..81bafaf6faf 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3462,7 +3462,7 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) args[i]->fix_fields(thd, args + i)) || args[i]->check_cols(1)) return TRUE; - with_subselect|= args[i]->with_subselect; + with_subselect|= args[i]->with_subselect; } /* skip charset aggregation for order columns */ diff --git a/sql/log.cc b/sql/log.cc index 23326532388..7ad9790bb13 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB + Copyright (c) 2009, 2017, 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 @@ -646,7 +646,7 @@ void Log_to_csv_event_handler::cleanup() bool Log_to_csv_event_handler:: log_general(THD *thd, my_hrtime_t event_time, const char *user_host, - uint user_host_len, int thread_id_arg, + uint user_host_len, my_thread_id thread_id_arg, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs) @@ -1056,7 +1056,7 @@ bool Log_to_file_event_handler:: bool Log_to_file_event_handler:: log_general(THD *thd, my_hrtime_t event_time, const char *user_host, - uint user_host_len, int thread_id_arg, + uint user_host_len, my_thread_id thread_id_arg, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs) @@ -2850,12 +2850,11 @@ void MYSQL_QUERY_LOG::reopen_file() */ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host, - uint user_host_len, int thread_id_arg, + uint user_host_len, my_thread_id thread_id_arg, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len) { char buff[32]; - uint length= 0; char local_time_buff[MAX_TIME_SIZE]; struct tm start; uint time_buff_len= 0; @@ -2889,7 +2888,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host, goto err; /* command_type, thread_id */ - length= my_snprintf(buff, 32, "%5ld ", (long) thread_id_arg); + size_t length= my_snprintf(buff, 32, "%5llu ", thread_id_arg); if (my_b_write(&log_file, (uchar*) buff, length)) goto err; @@ -2973,7 +2972,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, int tmp_errno= 0; char buff[80], *end; char query_time_buff[22+7], lock_time_buff[22+7]; - uint buff_len; + size_t buff_len; end= buff; if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT)) @@ -10244,8 +10243,8 @@ IO_CACHE * get_trans_log(THD * thd) if (cache_mngr) return cache_mngr->get_binlog_cache_log(true); - WSREP_DEBUG("binlog cache not initialized, conn: %lld", - (longlong) thd->thread_id); + WSREP_DEBUG("binlog cache not initialized, conn: %llu", + thd->thread_id); return NULL; } @@ -10283,8 +10282,8 @@ void thd_binlog_trx_reset(THD * thd) void thd_binlog_rollback_stmt(THD * thd) { - WSREP_DEBUG("thd_binlog_rollback_stmt connection: %lld", - (longlong) thd->thread_id); + WSREP_DEBUG("thd_binlog_rollback_stmt connection: %llu", + thd->thread_id); binlog_cache_mngr *const cache_mngr= (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); if (cache_mngr) diff --git a/sql/log.h b/sql/log.h index 8ddf8641cfa..f1a025edfb9 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1,5 +1,5 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, Monty Program Ab + Copyright (c) 2009, 2017, 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 @@ -287,9 +287,9 @@ typedef struct st_log_info #define MAX_LOG_HANDLERS_NUM 3 /* log event handler flags */ -#define LOG_NONE 1 -#define LOG_FILE 2 -#define LOG_TABLE 4 +#define LOG_NONE 1U +#define LOG_FILE 2U +#define LOG_TABLE 4U class Log_event; class Rows_log_event; @@ -355,7 +355,7 @@ public: MYSQL_QUERY_LOG() : last_time(0) {} void reopen_file(); bool write(time_t event_time, const char *user_host, - uint user_host_len, int thread_id, + uint user_host_len, my_thread_id thread_id, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len); bool write(THD *thd, time_t current_time, @@ -907,7 +907,7 @@ public: virtual bool log_error(enum loglevel level, const char *format, va_list args)= 0; virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, - uint user_host_len, int thread_id, + uint user_host_len, my_thread_id thread_id, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs)= 0; @@ -936,7 +936,7 @@ public: virtual bool log_error(enum loglevel level, const char *format, va_list args); virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, - uint user_host_len, int thread_id, + uint user_host_len, my_thread_id thread_id, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs); @@ -968,7 +968,7 @@ public: virtual bool log_error(enum loglevel level, const char *format, va_list args); virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, - uint user_host_len, int thread_id, + uint user_host_len, my_thread_id thread_id, const char *command_type, uint command_type_len, const char *sql_text, uint sql_text_len, CHARSET_INFO *client_cs); diff --git a/sql/log_event.cc b/sql/log_event.cc index 291b550353d..69d0f52d211 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2894,8 +2894,8 @@ log_event_print_value(IO_CACHE *file, const uchar *ptr, case 2: { strmake(typestr, "ENUM(2 bytes)", typestr_length); - if (!ptr) - goto return_null; + if (!ptr) + goto return_null; int32 i32= uint2korr(ptr); my_b_printf(file, "%d", i32); diff --git a/sql/log_event.h b/sql/log_event.h index c2829a9bb10..5689d36aea8 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2014, Monty Program Ab. + Copyright (c) 2009, 2017, 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 @@ -828,7 +828,7 @@ typedef struct st_print_event_info char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH]; uint lc_time_names_number; uint charset_database_number; - uint thread_id; + my_thread_id thread_id; bool thread_id_printed; uint32 server_id; bool server_id_printed; @@ -2008,7 +2008,7 @@ public: uint32 q_len; uint32 db_len; uint16 error_code; - ulong thread_id; + my_thread_id thread_id; /* For events created by Query_log_event::do_apply_event (and Load_log_event::do_apply_event()) we need the *original* thread @@ -2435,7 +2435,7 @@ public: void print_query(THD *thd, bool need_db, const char *cs, String *buf, my_off_t *fn_start, my_off_t *fn_end, const char *qualify_db); - ulong thread_id; + my_thread_id thread_id; ulong slave_proxy_id; uint32 table_name_len; /* diff --git a/sql/log_slow.h b/sql/log_slow.h index 3ae2060cc27..c641d2be87d 100644 --- a/sql/log_slow.h +++ b/sql/log_slow.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Monty Program Ab +/* Copyright (C) 2009, 2017, 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 @@ -16,23 +16,22 @@ /* Defining what to log to slow log */ #define LOG_SLOW_VERBOSITY_INIT 0 -#define LOG_SLOW_VERBOSITY_INNODB (1 << 0) -#define LOG_SLOW_VERBOSITY_QUERY_PLAN (1 << 1) -#define LOG_SLOW_VERBOSITY_EXPLAIN (1 << 2) +#define LOG_SLOW_VERBOSITY_INNODB (1U << 0) +#define LOG_SLOW_VERBOSITY_QUERY_PLAN (1U << 1) +#define LOG_SLOW_VERBOSITY_EXPLAIN (1U << 2) #define QPLAN_INIT QPLAN_QC_NO -#define QPLAN_ADMIN (1 << 0) -#define QPLAN_FILESORT (1 << 1) -#define QPLAN_FILESORT_DISK (1 << 2) -#define QPLAN_FULL_JOIN (1 << 3) -#define QPLAN_FULL_SCAN (1 << 4) -#define QPLAN_QC (1 << 5) -#define QPLAN_QC_NO (1 << 6) -#define QPLAN_TMP_DISK (1 << 7) -#define QPLAN_TMP_TABLE (1 << 8) -#define QPLAN_FILESORT_PRIORITY_QUEUE (1 << 9) +#define QPLAN_ADMIN (1U << 0) +#define QPLAN_FILESORT (1U << 1) +#define QPLAN_FILESORT_DISK (1U << 2) +#define QPLAN_FULL_JOIN (1U << 3) +#define QPLAN_FULL_SCAN (1U << 4) +#define QPLAN_QC (1U << 5) +#define QPLAN_QC_NO (1U << 6) +#define QPLAN_TMP_DISK (1U << 7) +#define QPLAN_TMP_TABLE (1U << 8) +#define QPLAN_FILESORT_PRIORITY_QUEUE (1U << 9) /* ... */ -#define QPLAN_MAX (((ulong) 1) << 31) /* reserved as placeholder */ - +#define QPLAN_MAX (1UL << 31) /* reserved as placeholder */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f639a357880..8fb2cb04b92 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8762,7 +8762,7 @@ static int mysql_init_variables(void) mysql_home_ptr= mysql_home; log_error_file_ptr= log_error_file; protocol_version= PROTOCOL_VERSION; - what_to_log= ~ (1L << (uint) COM_TIME); + what_to_log= ~(1UL << COM_TIME); denied_connections= 0; executed_events= 0; global_query_id= 1; diff --git a/sql/mysqld.h b/sql/mysqld.h index 9022b8cef03..8f74194181a 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -1,5 +1,5 @@ /* Copyright (c) 2006, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2016, MariaDB + Copyright (c) 2010, 2017, 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 @@ -49,16 +49,16 @@ typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */ #endif /* Bits from testflag */ -#define TEST_PRINT_CACHED_TABLES 1 -#define TEST_NO_KEY_GROUP 2 -#define TEST_MIT_THREAD 4 -#define TEST_BLOCKING 8 -#define TEST_KEEP_TMP_TABLES 16 -#define TEST_READCHECK 64 /**< Force use of readcheck */ -#define TEST_NO_EXTRA 128 -#define TEST_CORE_ON_SIGNAL 256 /**< Give core if signal */ -#define TEST_SIGINT 1024 /**< Allow sigint on threads */ -#define TEST_SYNCHRONIZATION 2048 /**< get server to do sleep in +#define TEST_PRINT_CACHED_TABLES 1U +#define TEST_NO_KEY_GROUP 2U +#define TEST_MIT_THREAD 4U +#define TEST_BLOCKING 8U +#define TEST_KEEP_TMP_TABLES 16U +#define TEST_READCHECK 64U /**< Force use of readcheck */ +#define TEST_NO_EXTRA 128U +#define TEST_CORE_ON_SIGNAL 256U /**< Give core if signal */ +#define TEST_SIGINT 1024U /**< Allow sigint on threads */ +#define TEST_SYNCHRONIZATION 2048U /**< get server to do sleep in some places */ /* Keep things compatible */ @@ -721,7 +721,7 @@ inline query_id_t get_query_id() /* increment global_thread_id and return it. */ inline __attribute__((warn_unused_result)) my_thread_id next_thread_id() { - return my_atomic_add64_explicit(&global_thread_id, 1, MY_MEMORY_ORDER_RELAXED); + return my_atomic_add64_explicit((int64*) &global_thread_id, 1, MY_MEMORY_ORDER_RELAXED); } #if defined(MYSQL_DYNAMIC_PLUGIN) && defined(_WIN32) diff --git a/sql/session_tracker.h b/sql/session_tracker.h index 3f73b5dc705..684692aae0c 100644 --- a/sql/session_tracker.h +++ b/sql/session_tracker.h @@ -2,7 +2,7 @@ #define SESSION_TRACKER_INCLUDED /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2016, MariaDB + Copyright (c) 2016, 2017, 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 @@ -280,7 +280,7 @@ private: inline void update_change_flags(THD *thd) { - tx_changed &= ~TX_CHG_STATE; + tx_changed &= uint(~TX_CHG_STATE); tx_changed |= (tx_curr_state != tx_reported_state) ? TX_CHG_STATE : 0; if (tx_changed != TX_CHG_NONE) mark_as_changed(thd, NULL); diff --git a/sql/sql_acl.h b/sql/sql_acl.h index be206b1f86f..daa36f6c32a 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -2,6 +2,7 @@ #define SQL_ACL_INCLUDED /* Copyright (c) 2000, 2010, 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 the terms of the GNU General Public License as published by @@ -20,35 +21,35 @@ #include "violite.h" /* SSL_type */ #include "sql_class.h" /* LEX_COLUMN */ -#define SELECT_ACL (1L << 0) -#define INSERT_ACL (1L << 1) -#define UPDATE_ACL (1L << 2) -#define DELETE_ACL (1L << 3) -#define CREATE_ACL (1L << 4) -#define DROP_ACL (1L << 5) -#define RELOAD_ACL (1L << 6) -#define SHUTDOWN_ACL (1L << 7) -#define PROCESS_ACL (1L << 8) -#define FILE_ACL (1L << 9) -#define GRANT_ACL (1L << 10) -#define REFERENCES_ACL (1L << 11) -#define INDEX_ACL (1L << 12) -#define ALTER_ACL (1L << 13) -#define SHOW_DB_ACL (1L << 14) -#define SUPER_ACL (1L << 15) -#define CREATE_TMP_ACL (1L << 16) -#define LOCK_TABLES_ACL (1L << 17) -#define EXECUTE_ACL (1L << 18) -#define REPL_SLAVE_ACL (1L << 19) -#define REPL_CLIENT_ACL (1L << 20) -#define CREATE_VIEW_ACL (1L << 21) -#define SHOW_VIEW_ACL (1L << 22) -#define CREATE_PROC_ACL (1L << 23) -#define ALTER_PROC_ACL (1L << 24) -#define CREATE_USER_ACL (1L << 25) -#define EVENT_ACL (1L << 26) -#define TRIGGER_ACL (1L << 27) -#define CREATE_TABLESPACE_ACL (1L << 28) +#define SELECT_ACL (1UL << 0) +#define INSERT_ACL (1UL << 1) +#define UPDATE_ACL (1UL << 2) +#define DELETE_ACL (1UL << 3) +#define CREATE_ACL (1UL << 4) +#define DROP_ACL (1UL << 5) +#define RELOAD_ACL (1UL << 6) +#define SHUTDOWN_ACL (1UL << 7) +#define PROCESS_ACL (1UL << 8) +#define FILE_ACL (1UL << 9) +#define GRANT_ACL (1UL << 10) +#define REFERENCES_ACL (1UL << 11) +#define INDEX_ACL (1UL << 12) +#define ALTER_ACL (1UL << 13) +#define SHOW_DB_ACL (1UL << 14) +#define SUPER_ACL (1UL << 15) +#define CREATE_TMP_ACL (1UL << 16) +#define LOCK_TABLES_ACL (1UL << 17) +#define EXECUTE_ACL (1UL << 18) +#define REPL_SLAVE_ACL (1UL << 19) +#define REPL_CLIENT_ACL (1UL << 20) +#define CREATE_VIEW_ACL (1UL << 21) +#define SHOW_VIEW_ACL (1UL << 22) +#define CREATE_PROC_ACL (1UL << 23) +#define ALTER_PROC_ACL (1UL << 24) +#define CREATE_USER_ACL (1UL << 25) +#define EVENT_ACL (1UL << 26) +#define TRIGGER_ACL (1UL << 27) +#define CREATE_TABLESPACE_ACL (1UL << 28) /* don't forget to update 1. static struct show_privileges_st sys_privileges[] @@ -57,7 +58,7 @@ 4. acl_init() or whatever - to define behaviour for old privilege tables 5. sql_yacc.yy - for GRANT/REVOKE to work */ -#define NO_ACCESS (1L << 30) +#define NO_ACCESS (1UL << 30) #define DB_ACLS \ (UPDATE_ACL | SELECT_ACL | INSERT_ACL | DELETE_ACL | CREATE_ACL | DROP_ACL | \ GRANT_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL | CREATE_TMP_ACL | \ diff --git a/sql/sql_audit.h b/sql/sql_audit.h index d6f670538cd..5f530c676c3 100644 --- a/sql/sql_audit.h +++ b/sql/sql_audit.h @@ -2,6 +2,7 @@ #define SQL_AUDIT_INCLUDED /* Copyright (c) 2007, 2013, 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 the terms of the GNU General Public License as published by @@ -160,7 +161,7 @@ void mysql_audit_general(THD *thd, uint event_subtype, event.general_user_length= make_user_name(thd, user_buff); event.general_thread_id= (unsigned long)thd->thread_id; event.general_query= thd->query_string.str(); - event.general_query_length= thd->query_string.length(); + event.general_query_length= (unsigned) thd->query_string.length(); event.general_charset= thd->query_string.charset(); event.general_rows= thd->get_stmt_da()->current_row_for_warning(); event.database= thd->db; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 99c67186dbd..4f87d498300 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4823,9 +4823,9 @@ static bool fix_all_session_vcol_exprs(THD *thd, TABLE_LIST *tables) fix_session_vcol_expr(thd, (*df)->default_value)) goto err; - for (Virtual_column_info **cc= t->check_constraints; cc && *cc; cc++) - if (fix_session_vcol_expr(thd, (*cc))) - goto err; + for (Virtual_column_info **cc= t->check_constraints; cc && *cc; cc++) + if (fix_session_vcol_expr(thd, (*cc))) + goto err; thd->security_ctx= save_security_ctx; } diff --git a/sql/sql_class.h b/sql/sql_class.h index ffdd63f1f4c..22895d7a2d8 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB + Copyright (c) 2009, 2017, 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 @@ -179,7 +179,7 @@ public: } inline char *str() const { return string.str; } - inline uint32 length() const { return string.length; } + inline size_t length() const { return string.length; } CHARSET_INFO *charset() const { return cs; } friend LEX_STRING * thd_query_string (MYSQL_THD thd); @@ -1068,7 +1068,10 @@ public: inline char *query() const { return query_string.str(); } - inline uint32 query_length() const { return query_string.length(); } + inline uint32 query_length() const + { + return static_cast<uint32>(query_string.length()); + } CHARSET_INFO *query_charset() const { return query_string.charset(); } void set_query_inner(const CSET_STRING &string_arg) { diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index d8cd92ed10b..3011b510761 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -1259,9 +1259,9 @@ void With_clause::print(String *str, enum_query_type query_type) with_elem; with_elem= with_elem->next) { - with_elem->print(str, query_type); if (with_elem != with_list.first) str->append(", "); + with_elem->print(str, query_type); } } diff --git a/sql/sql_error.h b/sql/sql_error.h index aa8e6c6b0f3..3aef5d38368 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -1,4 +1,5 @@ /* Copyright (c) 2000, 2011, 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 the terms of the GNU General Public License as published by @@ -50,7 +51,7 @@ public: Convert a bitmask consisting of MYSQL_TIME_{NOTE|WARN}_XXX bits to WARN_LEVEL_XXX */ - static enum_warning_level time_warn_level(int warnings) + static enum_warning_level time_warn_level(uint warnings) { return MYSQL_TIME_WARN_HAVE_WARNINGS(warnings) ? WARN_LEVEL_WARN : WARN_LEVEL_NOTE; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b5a272a056d..671e00fb36d 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, 2017, 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 @@ -1498,8 +1498,8 @@ public: This has all flags from 0 (inclusive) to BINLOG_STMT_FLAG_COUNT (exclusive) set. */ - static const int BINLOG_STMT_UNSAFE_ALL_FLAGS= - ((1 << BINLOG_STMT_UNSAFE_COUNT) - 1); + static const uint32 BINLOG_STMT_UNSAFE_ALL_FLAGS= + ((1U << BINLOG_STMT_UNSAFE_COUNT) - 1); /** Maps elements of enum_binlog_stmt_unsafe to error codes. diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index 9a0acea1d18..7b89246a9f9 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -1,5 +1,5 @@ /* Copyright (c) 2005, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2012, Monty Program Ab + Copyright (c) 2009, 2017, 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 @@ -53,9 +53,9 @@ extern ulong dlopen_count; /* the following flags are valid for plugin_init() */ -#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1 -#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2 -#define PLUGIN_INIT_SKIP_INITIALIZATION 4 +#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1U +#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2U +#define PLUGIN_INIT_SKIP_INITIALIZATION 4U #define INITIAL_LEX_PLUGIN_LIST_SIZE 16 @@ -71,12 +71,12 @@ typedef struct st_mysql_show_var SHOW_VAR; It's a bitmap, because it makes it easier to test "whether the state is one of those..." */ -#define PLUGIN_IS_FREED 1 -#define PLUGIN_IS_DELETED 2 -#define PLUGIN_IS_UNINITIALIZED 4 -#define PLUGIN_IS_READY 8 -#define PLUGIN_IS_DYING 16 -#define PLUGIN_IS_DISABLED 32 +#define PLUGIN_IS_FREED 1U +#define PLUGIN_IS_DELETED 2U +#define PLUGIN_IS_UNINITIALIZED 4U +#define PLUGIN_IS_READY 8U +#define PLUGIN_IS_DYING 16U +#define PLUGIN_IS_DISABLED 32U struct st_ptr_backup { void **ptr; diff --git a/sql/sql_select.h b/sql/sql_select.h index 76cded43128..0d4570fbe47 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -2,7 +2,7 @@ #define SQL_SELECT_INCLUDED /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2015, MariaDB + Copyright (c) 2008, 2017, 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 @@ -36,9 +36,9 @@ typedef struct st_join_table JOIN_TAB; /* Values in optimize */ -#define KEY_OPTIMIZE_EXISTS 1 -#define KEY_OPTIMIZE_REF_OR_NULL 2 -#define KEY_OPTIMIZE_EQ 4 +#define KEY_OPTIMIZE_EXISTS 1U +#define KEY_OPTIMIZE_REF_OR_NULL 2U +#define KEY_OPTIMIZE_EQ 4U inline uint get_hash_join_key_no() { return MAX_KEY; } @@ -178,10 +178,10 @@ enum sj_strategy_enum }; /* Values for JOIN_TAB::packed_info */ -#define TAB_INFO_HAVE_VALUE 1 -#define TAB_INFO_USING_INDEX 2 -#define TAB_INFO_USING_WHERE 4 -#define TAB_INFO_FULL_SCAN_ON_NULL 8 +#define TAB_INFO_HAVE_VALUE 1U +#define TAB_INFO_USING_INDEX 2U +#define TAB_INFO_USING_WHERE 4U +#define TAB_INFO_FULL_SCAN_ON_NULL 8U typedef enum_nested_loop_state (*Next_select_func)(JOIN *, struct st_join_table *, bool); diff --git a/sql/sql_string.h b/sql/sql_string.h index 8062e2d465d..0a930554d8a 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -3,7 +3,7 @@ /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. - Copyright (c) 2008, 2013, Monty Program Ab. + Copyright (c) 2008, 2017, 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 @@ -97,9 +97,9 @@ public: Convert a string between character sets. "dstcs" and "srccs" cannot be &my_charset_bin. */ - uint convert_fix(CHARSET_INFO *dstcs, char *dst, uint dst_length, - CHARSET_INFO *srccs, const char *src, uint src_length, - uint nchars) + size_t convert_fix(CHARSET_INFO *dstcs, char *dst, uint dst_length, + CHARSET_INFO *srccs, const char *src, uint src_length, + uint nchars) { return my_convert_fix(dstcs, dst, dst_length, srccs, src, src_length, nchars, this, this); @@ -677,7 +677,7 @@ public: { DBUG_ASSERT(Alloced_length >= (str_length + net_length_size(length))); char *pos= (char *) net_store_length((uchar *)(Ptr + str_length), length); - str_length= pos - Ptr; + str_length= uint32(pos - Ptr); } void q_net_store_data(const uchar *from, size_t length) { diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 4834e10da3d..7c06ff96c32 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2010, 2016, MariaDB + Copyright (c) 2010, 2017, 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 @@ -2845,7 +2845,7 @@ bool check_duplicates_in_interval(const char *set_or_name, */ bool Column_definition::prepare_create_field(uint *blob_columns, - longlong table_flags) + ulonglong table_flags) { uint dup_val_count; uint decimals_orig= decimals; diff --git a/sql/sql_table.h b/sql/sql_table.h index 1750def3a84..5b2c9f32443 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -1,5 +1,5 @@ /* Copyright (c) 2006, 2014, Oracle and/or its affiliates. - Copyright (c) 2011, 2014, Monty Program Ab. + Copyright (c) 2011, 2017, 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 @@ -251,6 +251,7 @@ bool quick_rm_table(THD *thd, handlerton *base, const char *db, const char *table_name, uint flags, const char *table_path=0); void close_cached_table(THD *thd, TABLE *table); +void sp_prepare_create_field(THD *thd, Column_definition *sql_field); CHARSET_INFO* get_sql_field_charset(Create_field *sql_field, HA_CREATE_INFO *create_info); bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags); diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index afe47fb36f4..9d1c79cc7cf 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -3,6 +3,7 @@ /* Copyright (c) 2004, 2011, Oracle and/or its affiliates. + Copyright (c) 2017, 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 @@ -273,8 +274,8 @@ public: Field **nullable_fields() { return record0_field; } void reset_extra_null_bitmap() { - int null_bytes= (trigger_table->s->stored_fields - - trigger_table->s->null_fields + 7)/8; + size_t null_bytes= (trigger_table->s->stored_fields - + trigger_table->s->null_fields + 7)/8; bzero(extra_null_bitmap, null_bytes); } diff --git a/sql/structs.h b/sql/structs.h index ea47d6255de..98eb0f2585d 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -2,6 +2,7 @@ #define STRUCTS_INCLUDED /* Copyright (c) 2000, 2010, 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 the terms of the GNU General Public License as published by @@ -331,26 +332,26 @@ typedef struct st_index_stats /* Bits in form->update */ -#define REG_MAKE_DUPP 1 /* Make a copy of record when read */ -#define REG_NEW_RECORD 2 /* Write a new record if not found */ -#define REG_UPDATE 4 /* Uppdate record */ -#define REG_DELETE 8 /* Delete found record */ -#define REG_PROG 16 /* User is updating database */ -#define REG_CLEAR_AFTER_WRITE 32 -#define REG_MAY_BE_UPDATED 64 -#define REG_AUTO_UPDATE 64 /* Used in D-forms for scroll-tables */ -#define REG_OVERWRITE 128 -#define REG_SKIP_DUP 256 +#define REG_MAKE_DUPP 1U /* Make a copy of record when read */ +#define REG_NEW_RECORD 2U /* Write a new record if not found */ +#define REG_UPDATE 4U /* Uppdate record */ +#define REG_DELETE 8U /* Delete found record */ +#define REG_PROG 16U /* User is updating database */ +#define REG_CLEAR_AFTER_WRITE 32U +#define REG_MAY_BE_UPDATED 64U +#define REG_AUTO_UPDATE 64U /* Used in D-forms for scroll-tables */ +#define REG_OVERWRITE 128U +#define REG_SKIP_DUP 256U /* Bits in form->status */ -#define STATUS_NO_RECORD (1+2) /* Record isn't usably */ -#define STATUS_GARBAGE 1 -#define STATUS_NOT_FOUND 2 /* No record in database when needed */ -#define STATUS_NO_PARENT 4 /* Parent record wasn't found */ -#define STATUS_NOT_READ 8 /* Record isn't read */ -#define STATUS_UPDATED 16 /* Record is updated by formula */ -#define STATUS_NULL_ROW 32 /* table->null_row is set */ -#define STATUS_DELETED 64 +#define STATUS_NO_RECORD (1U+2U) /* Record isn't usable */ +#define STATUS_GARBAGE 1U +#define STATUS_NOT_FOUND 2U /* No record in database when needed */ +#define STATUS_NO_PARENT 4U /* Parent record wasn't found */ +#define STATUS_NOT_READ 8U /* Record isn't read */ +#define STATUS_UPDATED 16U /* Record is updated by formula */ +#define STATUS_NULL_ROW 32U /* table->null_row is set */ +#define STATUS_DELETED 64U /* Such interval is "discrete": it is the set of diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 40cdd84a292..9a9e920c6dd 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2465,7 +2465,7 @@ static Sys_var_uint Sys_protocol_version( "protocol_version", "The version of the client/server protocol used by the MySQL server", READ_ONLY GLOBAL_VAR(protocol_version), CMD_LINE_HELP_ONLY, - VALID_RANGE(0, ~0), DEFAULT(PROTOCOL_VERSION), BLOCK_SIZE(1)); + VALID_RANGE(0, ~0U), DEFAULT(PROTOCOL_VERSION), BLOCK_SIZE(1)); static Sys_var_proxy_user Sys_proxy_user( "proxy_user", "The proxy user account name used when logging in", diff --git a/sql/table.h b/sql/table.h index c4b2ba2945d..c1f2c5feebe 100644 --- a/sql/table.h +++ b/sql/table.h @@ -2,7 +2,7 @@ #define TABLE_INCLUDED /* Copyright (c) 2000, 2013, Oracle and/or its affiliates. Copyright (c) 2009, 2014, SkySQL Ab. - Copyright (c) 2016, MariaDB Corporation + Copyright (c) 2016, 2017, 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 @@ -1500,13 +1500,13 @@ typedef struct st_foreign_key_info LEX_CSTRING *fk_option_name(enum_fk_option opt); -#define MY_I_S_MAYBE_NULL 1 -#define MY_I_S_UNSIGNED 2 +#define MY_I_S_MAYBE_NULL 1U +#define MY_I_S_UNSIGNED 2U -#define SKIP_OPEN_TABLE 0 // do not open table -#define OPEN_FRM_ONLY 1 // open FRM file only -#define OPEN_FULL_TABLE 2 // open FRM,MYD, MYI files +#define SKIP_OPEN_TABLE 0U // do not open table +#define OPEN_FRM_ONLY 1U // open FRM file only +#define OPEN_FULL_TABLE 2U // open FRM,MYD, MYI files typedef struct st_field_info { @@ -1570,27 +1570,27 @@ class IS_table_read_plan; Types of derived tables. The ending part is a bitmap of phases that are applicable to a derived table of the type. */ -#define DTYPE_ALGORITHM_UNDEFINED 0 -#define DTYPE_VIEW 1 -#define DTYPE_TABLE 2 -#define DTYPE_MERGE 4 -#define DTYPE_MATERIALIZE 8 -#define DTYPE_MULTITABLE 16 -#define DTYPE_MASK 19 +#define DTYPE_ALGORITHM_UNDEFINED 0U +#define DTYPE_VIEW 1U +#define DTYPE_TABLE 2U +#define DTYPE_MERGE 4U +#define DTYPE_MATERIALIZE 8U +#define DTYPE_MULTITABLE 16U +#define DTYPE_MASK (DTYPE_VIEW|DTYPE_TABLE|DTYPE_MULTITABLE) /* Phases of derived tables/views handling, see sql_derived.cc Values are used as parts of a bitmap attached to derived table types. */ -#define DT_INIT 1 -#define DT_PREPARE 2 -#define DT_OPTIMIZE 4 -#define DT_MERGE 8 -#define DT_MERGE_FOR_INSERT 16 -#define DT_CREATE 32 -#define DT_FILL 64 -#define DT_REINIT 128 -#define DT_PHASES 8 +#define DT_INIT 1U +#define DT_PREPARE 2U +#define DT_OPTIMIZE 4U +#define DT_MERGE 8U +#define DT_MERGE_FOR_INSERT 16U +#define DT_CREATE 32U +#define DT_FILL 64U +#define DT_REINIT 128U +#define DT_PHASES 8U /* Phases that are applicable to all derived tables. */ #define DT_COMMON (DT_INIT + DT_PREPARE + DT_REINIT + DT_OPTIMIZE) /* Phases that are applicable only to materialized derived tables. */ @@ -1610,13 +1610,13 @@ class IS_table_read_plan; representation for backward compatibility. */ -#define VIEW_ALGORITHM_UNDEFINED_FRM 0 -#define VIEW_ALGORITHM_MERGE_FRM 1 -#define VIEW_ALGORITHM_TMPTABLE_FRM 2 +#define VIEW_ALGORITHM_UNDEFINED_FRM 0U +#define VIEW_ALGORITHM_MERGE_FRM 1U +#define VIEW_ALGORITHM_TMPTABLE_FRM 2U -#define JOIN_TYPE_LEFT 1 -#define JOIN_TYPE_RIGHT 2 -#define JOIN_TYPE_OUTER 4 /* Marker that this is an outer join */ +#define JOIN_TYPE_LEFT 1U +#define JOIN_TYPE_RIGHT 2U +#define JOIN_TYPE_OUTER 4U /* Marker that this is an outer join */ #define VIEW_SUID_INVOKER 0 #define VIEW_SUID_DEFINER 1 diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp index 1f5a1a27ae5..50535d20a3d 100644 --- a/storage/connect/blkfil.cpp +++ b/storage/connect/blkfil.cpp @@ -412,7 +412,7 @@ void BLKFILMR2::MakeValueBitmap(void) Void = !Bmp[N]; // There are no good values in the file for (i = 0; i < N; i++) { - Bxp[i] = ~0; + Bxp[i] = ~0U; if (noteq) Bmp[i] = Bxp[i]; @@ -708,7 +708,7 @@ void BLKFILIN2::MakeValueBitmap(void) Void = !Bmp[N]; // There are no good values in the file for (i = 0; i < N; i++) { - Bxp[i] = ~0; + Bxp[i] = ~0U; if (noteq) { Bmp[i] = Bxp[i]; @@ -828,7 +828,7 @@ BLKFILIN2::BLKFILIN2(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp) Bxp[i] |= btp; for (N = i--; i >= 0; i--) - Bxp[i] = ~0; + Bxp[i] = ~0U; break; } // endif Bmp diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 4bebb9ee7dd..49ac63cff6d 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2016, MariaDB Corporation +Copyright (c) 2014, 2017, 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 @@ -725,7 +725,7 @@ btr_page_free_low( offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap); - uint size = rec_offs_data_size(offsets); + ulint size = rec_offs_data_size(offsets); memset(rec, 0, size); rec = page_rec_get_next(rec); cnt++; @@ -890,7 +890,7 @@ btr_page_get_father_node_ptr_func( ulint latch_mode,/*!< in: BTR_CONT_MODIFY_TREE or BTR_CONT_SEARCH_TREE */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dtuple_t* tuple; @@ -2396,7 +2396,7 @@ btr_insert_on_non_leaf_level_func( ulint level, /*!< in: level, must be > 0 */ dtuple_t* tuple, /*!< in: the record to be inserted */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { big_rec_t* dummy_big_rec; diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index bdf3bd2eca7..06b5b66c2aa 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -105,22 +105,24 @@ throughput clearly from about 100000. */ #define BTR_CUR_FINE_HISTORY_LENGTH 100000 /** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */ -ulint btr_cur_n_non_sea = 0; -/** Number of successful adaptive hash index lookups in -btr_cur_search_to_nth_level(). */ -ulint btr_cur_n_sea = 0; +ulint btr_cur_n_non_sea; /** Old value of btr_cur_n_non_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ -ulint btr_cur_n_non_sea_old = 0; +ulint btr_cur_n_non_sea_old; +#ifdef BTR_CUR_HASH_ADAPT +/** Number of successful adaptive hash index lookups in +btr_cur_search_to_nth_level(). */ +ulint btr_cur_n_sea; /** Old value of btr_cur_n_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ -ulint btr_cur_n_sea_old = 0; +ulint btr_cur_n_sea_old; +#endif /* BTR_CUR_HASH_ADAPT */ #ifdef UNIV_DEBUG /* Flag to limit optimistic insert records */ -uint btr_cur_limit_optimistic_insert_debug = 0; +uint btr_cur_limit_optimistic_insert_debug; #endif /* UNIV_DEBUG */ /** In the optimistic insert, if the insert does not fit, but this much space @@ -146,7 +148,7 @@ can be released by page reorganize, then it is reorganized */ @param not_empty table not empty @return estimated table wide stats from sampled value */ #define BTR_TABLE_STATS_FROM_SAMPLE(value, index, sample, ext_size, not_empty) \ - (((value) * static_cast<int64_t>(index->stat_n_leaf_pages) \ + (((value) * static_cast<ib_uint64_t>(index->stat_n_leaf_pages) \ + (sample) - 1 + (ext_size) + (not_empty)) / ((sample) + (ext_size))) /* @} */ @@ -412,7 +414,7 @@ btr_cur_optimistic_latch_leaves( ulint* latch_mode, btr_cur_t* cursor, const char* file, - ulint line, + unsigned line, mtr_t* mtr) { ulint mode; @@ -745,7 +747,7 @@ btr_cur_search_to_nth_level( caller currently has on search system: RW_S_LATCH, or 0 */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr, /*!< in: mtr */ ib_uint64_t autoinc)/*!< in: PAGE_ROOT_AUTO_INC to be written (0 if none) */ @@ -953,7 +955,7 @@ btr_cur_search_to_nth_level( if (has_search_latch) { /* Release possible search latch to obey latching order */ - rw_lock_s_unlock(btr_get_search_latch(index)); + btr_search_s_unlock(index); } /* Store the position of the tree latch we push to mtr so that we @@ -1477,6 +1479,7 @@ retry_page_get: cursor->low_match = DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1; } +#ifdef BTR_CUR_HASH_ADAPT } else if (height == 0 && btr_search_enabled && !dict_index_is_spatial(index)) { /* The adaptive hash index is only used when searching @@ -1486,6 +1489,7 @@ retry_page_get: page_cur_search_with_match_bytes( block, index, tuple, page_mode, &up_match, &up_bytes, &low_match, &low_bytes, page_cursor); +#endif /* BTR_CUR_HASH_ADAPT */ } else { /* Search for complete index fields. */ up_bytes = low_bytes = 0; @@ -1966,7 +1970,7 @@ need_opposite_intention: index, autoinc, mtr, false); } -#ifdef BTR_CUR_ADAPT +#ifdef BTR_CUR_HASH_ADAPT /* We do a dirty read of btr_search_enabled here. We will properly check btr_search_enabled again in btr_search_build_page_hash_index() before building a @@ -1978,7 +1982,7 @@ need_opposite_intention: ) { btr_search_info_update(index, cursor); } -#endif +#endif /* BTR_CUR_HASH_ADAPT */ ut_ad(cursor->up_match != ULINT_UNDEFINED || mode != PAGE_CUR_GE); ut_ad(cursor->up_match != ULINT_UNDEFINED @@ -2014,8 +2018,7 @@ func_exit: } if (has_search_latch) { - - rw_lock_s_lock(btr_get_search_latch(index)); + btr_search_s_lock(index); } if (mbr_adj) { @@ -2039,7 +2042,7 @@ btr_cur_open_at_index_side_func( ulint level, /*!< in: level to search for (0=leaf). */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in/out: mini-transaction */ { page_cur_t* page_cursor; @@ -2411,7 +2414,7 @@ btr_cur_open_at_rnd_pos_func( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* cursor, /*!< in/out: B-tree cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { page_cur_t* page_cursor; @@ -3271,12 +3274,12 @@ btr_cur_pessimistic_insert( } } -#ifdef BTR_CUR_ADAPT +#ifdef BTR_CUR_HASH_ADAPT # ifdef MYSQL_INDEX_DISABLE_AHI if (index->disable_ahi); else # endif btr_search_update_hash_on_insert(cursor); -#endif +#endif /* BTR_CUR_HASH_ADAPT */ if (inherit && !(flags & BTR_NO_LOCKING_FLAG)) { lock_update_insert(btr_cur_get_block(cursor), *rec); @@ -3609,7 +3612,6 @@ btr_cur_update_in_place( rec_t* rec; roll_ptr_t roll_ptr = 0; ulint was_delete_marked; - ibool is_hashed; rec = btr_cur_get_rec(cursor); index = cursor->index; @@ -3621,7 +3623,7 @@ btr_cur_update_in_place( ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) || dict_index_is_clust(index)); ut_ad(thr_get_trx(thr)->id == trx_id - || (flags & ~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP)) + || (flags & ulint(~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP))) == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG)); ut_ad(fil_page_index_page_check(btr_cur_get_page(cursor))); @@ -3668,9 +3670,8 @@ btr_cur_update_in_place( was_delete_marked = rec_get_deleted_flag( rec, page_is_comp(buf_block_get_frame(block))); - is_hashed = (block->index != NULL); - - if (is_hashed) { +#ifdef BTR_CUR_HASH_ADAPT + if (block->index) { /* TO DO: Can we skip this if none of the fields index->search_info->curr_n_fields are being updated? */ @@ -3687,14 +3688,17 @@ btr_cur_update_in_place( btr_search_update_hash_on_delete(cursor); } - rw_lock_x_lock(btr_get_search_latch(index)); + btr_search_x_lock(index); } +#endif /* BTR_CUR_HASH_ADAPT */ row_upd_rec_in_place(rec, index, offsets, update, page_zip); - if (is_hashed) { - rw_lock_x_unlock(btr_get_search_latch(index)); +#ifdef BTR_CUR_HASH_ADAPT + if (block->index) { + btr_search_x_unlock(index); } +#endif /* BTR_CUR_HASH_ADAPT */ btr_cur_update_in_place_log(flags, rec, index, update, trx_id, roll_ptr, mtr); @@ -3786,7 +3790,7 @@ btr_cur_optimistic_update( ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) || dict_index_is_clust(index)); ut_ad(thr_get_trx(thr)->id == trx_id - || (flags & ~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP)) + || (flags & ulint(~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP))) == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG)); ut_ad(fil_page_index_page_check(page)); @@ -4119,7 +4123,7 @@ btr_cur_pessimistic_update( ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG) || dict_index_is_clust(index)); ut_ad(thr_get_trx(thr)->id == trx_id - || (flags & ~BTR_KEEP_POS_FLAG) + || (flags & ulint(~BTR_KEEP_POS_FLAG)) == (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG | BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG)); @@ -6227,12 +6231,12 @@ btr_cur_set_ownership_of_extern_field( byte_val = mach_read_from_1(data + local_len + BTR_EXTERN_LEN); if (val) { - byte_val = byte_val & (~BTR_EXTERN_OWNER_FLAG); + byte_val &= ~BTR_EXTERN_OWNER_FLAG; } else { #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG ut_a(!(byte_val & BTR_EXTERN_OWNER_FLAG)); #endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */ - byte_val = byte_val | BTR_EXTERN_OWNER_FLAG; + byte_val |= BTR_EXTERN_OWNER_FLAG; } if (page_zip) { diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 7f06aed9ff0..8c4f27cc78a 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved. -Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2017, 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 @@ -696,8 +696,8 @@ btr_defragment_n_pages( (data_size_per_rec * srv_defragment_fill_factor_n_recs)); optimal_page_size -= reserved_space; - n_new_slots = (total_data_size + optimal_page_size - 1) - / optimal_page_size; + n_new_slots = uint((total_data_size + optimal_page_size - 1) + / optimal_page_size); if (n_new_slots >= n_pages) { /* Can't defragment. */ if (end_of_index) diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index ecf3f7c07cb..741f16e0df4 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -229,7 +229,7 @@ btr_pcur_restore_position_func( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: detached persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dict_index_t* index; @@ -586,7 +586,7 @@ btr_pcur_open_on_user_rec_func( btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { btr_pcur_open_low(index, 0, tuple, mode, latch_mode, cursor, diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc index 8051c517e3a..e2670521cf3 100644 --- a/storage/innobase/btr/btr0scrub.cc +++ b/storage/innobase/btr/btr0scrub.cc @@ -254,11 +254,10 @@ btr_page_needs_scrubbing( return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE; } - page_t* page = buf_block_get_frame(block); - uint type = fil_page_get_type(page); + const page_t* page = buf_block_get_frame(block); if (allocated == BTR_SCRUB_PAGE_ALLOCATED) { - if (type != FIL_PAGE_INDEX) { + if (fil_page_get_type(page) != FIL_PAGE_INDEX) { /* this function is called from fil-crypt-threads. * these threads iterate all pages of all tablespaces * and don't know about fil_page_type. @@ -275,7 +274,7 @@ btr_page_needs_scrubbing( return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE; } - if (page_has_garbage(page) == false) { + if (!page_has_garbage(page)) { /* no garbage (from deleted/shrunken records) */ return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE; } @@ -283,11 +282,12 @@ btr_page_needs_scrubbing( } else if (allocated == BTR_SCRUB_PAGE_FREE || allocated == BTR_SCRUB_PAGE_ALLOCATION_UNKNOWN) { - if (! (type == FIL_PAGE_INDEX || - type == FIL_PAGE_TYPE_BLOB || - type == FIL_PAGE_TYPE_ZBLOB || - type == FIL_PAGE_TYPE_ZBLOB2)) { - + switch (fil_page_get_type(page)) { + case FIL_PAGE_INDEX: + case FIL_PAGE_TYPE_ZBLOB: + case FIL_PAGE_TYPE_ZBLOB2: + break; + default: /** * If this is a dropped page, we also need to scrub * BLOB pages @@ -299,7 +299,8 @@ btr_page_needs_scrubbing( } } - if (btr_page_get_index_id(page) == IBUF_INDEX_ID) { + if (block->page.id.space() == TRX_SYS_SPACE + && btr_page_get_index_id(page) == IBUF_INDEX_ID) { /* skip ibuf */ return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE; } diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 0af2a8b637c..86827fabdd4 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -2,6 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. +Copyright (c) 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -31,6 +32,7 @@ Created 2/17/1996 Heikki Tuuri *************************************************************************/ #include "btr0sea.h" +#ifdef BTR_CUR_HASH_ADAPT #ifdef UNIV_NONINL #include "btr0sea.ic" #endif /* UNIV_NOINL */ @@ -375,43 +377,6 @@ btr_search_enable() btr_search_x_unlock_all(); } -/** Creates and initializes a search info struct. -@param[in] heap heap where created. -@return own: search info struct */ -btr_search_t* -btr_search_info_create(mem_heap_t* heap) -{ - btr_search_t* info; - - info = (btr_search_t*) mem_heap_alloc(heap, sizeof(btr_search_t)); - - ut_d(info->magic_n = BTR_SEARCH_MAGIC_N); - - info->ref_count = 0; - info->root_guess = NULL; - info->withdraw_clock = 0; - - info->hash_analysis = 0; - info->n_hash_potential = 0; - - info->last_hash_succ = FALSE; - -#ifdef UNIV_SEARCH_PERF_STAT - info->n_hash_succ = 0; - info->n_hash_fail = 0; - info->n_patt_succ = 0; - info->n_searches = 0; -#endif /* UNIV_SEARCH_PERF_STAT */ - - /* Set some sensible values */ - info->n_fields = 1; - info->n_bytes = 0; - - info->left_side = TRUE; - - return(info); -} - /** Returns the value of ref_count. The value is protected by latch. @param[in] info search info @param[in] index index identifier @@ -1583,9 +1548,9 @@ btr_search_build_page_hash_index( block->n_hash_helps = 0; - block->curr_n_fields = n_fields; - block->curr_n_bytes = n_bytes; - block->curr_left_side = left_side; + block->curr_n_fields = unsigned(n_fields); + block->curr_n_bytes = unsigned(n_bytes); + block->curr_left_side = unsigned(left_side); block->index = index; for (i = 0; i < n_cached; i++) { @@ -2177,3 +2142,4 @@ btr_search_validate() } #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index b9968f39a81..a1827e7b3b5 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1536,7 +1536,9 @@ buf_block_init( ut_d(block->page.file_page_was_freed = FALSE); +#ifdef BTR_CUR_HASH_ADAPT block->index = NULL; +#endif /* BTR_CUR_HASH_ADAPT */ block->skip_flush_check = false; ut_d(block->page.in_page_hash = FALSE); @@ -1547,9 +1549,11 @@ buf_block_init( ut_d(block->in_unzip_LRU_list = FALSE); ut_d(block->in_withdraw_list = FALSE); -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG block->n_pointers = 0; -#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ page_zip_des_init(&block->page.zip); mutex_create(LATCH_ID_BUF_BLOCK_MUTEX, &block->mutex); @@ -1950,7 +1954,8 @@ buf_pool_init_instance( buf_pool->watch = (buf_page_t*) ut_zalloc_nokey( sizeof(*buf_pool->watch) * BUF_POOL_WATCH_SIZE); for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) { - buf_pool->watch[i].buf_pool_index = buf_pool->instance_no; + buf_pool->watch[i].buf_pool_index + = unsigned(buf_pool->instance_no); } /* All fields are initialized by ut_zalloc_nokey(). */ @@ -2260,11 +2265,13 @@ buf_page_realloc( /* set other flags of buf_block_t */ +#ifdef BTR_CUR_HASH_ADAPT ut_ad(!block->index); new_block->index = NULL; new_block->n_hash_helps = 0; new_block->n_fields = 1; new_block->left_side = TRUE; +#endif /* BTR_CUR_HASH_ADAPT */ new_block->lock_hash_val = block->lock_hash_val; ut_ad(new_block->lock_hash_val == lock_rec_hash( @@ -2726,7 +2733,7 @@ buf_pool_resize() buf_pool_mutex_exit(buf_pool); } - +#ifdef BTR_CUR_HASH_ADAPT /* disable AHI if needed */ bool btr_search_disabled = false; @@ -2745,6 +2752,7 @@ buf_pool_resize() if (btr_search_disabled) { ib::info() << "disabled adaptive hash index."; } +#endif /* BTR_CUR_HASH_ADAPT */ /* set withdraw target */ for (ulint i = 0; i < srv_buf_pool_instances; i++) { @@ -3116,7 +3124,10 @@ calc_buf_pool_size: dict_resize(); ib::info() << "Resized hash tables at lock_sys," - " adaptive hash index, dictionary."; +#ifdef BTR_CUR_HASH_ADAPT + " adaptive hash index," +#endif /* BTR_CUR_HASH_ADAPT */ + " dictionary."; } /* normalize ibuf->max_size */ @@ -3130,11 +3141,13 @@ calc_buf_pool_size: srv_buf_pool_old_size = srv_buf_pool_size; } +#ifdef BTR_CUR_HASH_ADAPT /* enable AHI if needed */ if (btr_search_disabled) { btr_search_enable(); ib::info() << "Re-enabled adaptive hash index."; } +#endif /* BTR_CUR_HASH_ADAPT */ char now[32]; @@ -3196,11 +3209,10 @@ DECLARE_THREAD(buf_resize_thread)(void*) OS_THREAD_DUMMY_RETURN; } -/********************************************************************//** -Clears the adaptive hash index on all pages in the buffer pool. */ +#ifdef BTR_CUR_HASH_ADAPT +/** Clear the adaptive hash index on all pages in the buffer pool. */ void -buf_pool_clear_hash_index(void) -/*===========================*/ +buf_pool_clear_hash_index() { ulint p; @@ -3237,6 +3249,7 @@ buf_pool_clear_hash_index(void) } } } +#endif /* BTR_CUR_HASH_ADAPT */ /********************************************************************//** Relocate a buffer control block. Relocates the block on the LRU list @@ -3920,13 +3933,15 @@ buf_block_init_low( /*===============*/ buf_block_t* block) /*!< in: block to init */ { - block->index = NULL; block->skip_flush_check = false; +#ifdef BTR_CUR_HASH_ADAPT + block->index = NULL; block->n_hash_helps = 0; block->n_fields = 1; block->n_bytes = 0; block->left_side = TRUE; +#endif /* BTR_CUR_HASH_ADAPT */ } /********************************************************************//** @@ -3998,6 +4013,7 @@ buf_zip_decompress( return(FALSE); } +#ifdef BTR_CUR_HASH_ADAPT /** Get a buffer block from an adaptive hash index pointer. This function does not return if the block is not identified. @param[in] ptr pointer to within a page frame @@ -4040,6 +4056,7 @@ buf_block_from_ahi(const byte* ptr) ut_ad(state == BUF_BLOCK_FILE_PAGE || state == BUF_BLOCK_REMOVE_HASH); return(block); } +#endif /* BTR_CUR_HASH_ADAPT */ /********************************************************************//** Find out if a pointer belongs to a buf_block_t. It can be a pointer to @@ -4196,7 +4213,7 @@ buf_page_get_gen( buf_block_t* guess, ulint mode, const char* file, - ulint line, + unsigned line, mtr_t* mtr, dberr_t* err) { @@ -4866,7 +4883,7 @@ buf_page_optimistic_get( buf_block_t* block, /*!< in: guessed buffer block */ ib_uint64_t modify_clock,/*!< in: modify clock value */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mini-transaction */ { buf_pool_t* buf_pool; @@ -4986,7 +5003,7 @@ buf_page_get_known_nowait( buf_block_t* block, /*!< in: the known page */ ulint mode, /*!< in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mini-transaction */ { buf_pool_t* buf_pool; @@ -5094,7 +5111,7 @@ buf_block_t* buf_page_try_get_func( const page_id_t& page_id, const char* file, - ulint line, + unsigned line, mtr_t* mtr) { buf_block_t* block; @@ -7452,7 +7469,8 @@ buf_page_encrypt_before_write( page_size, dst_frame); - ulint key_version = mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); + uint32_t key_version = mach_read_from_4( + dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); ut_ad(key_version == 0 || key_version >= bpage->key_version); bpage->key_version = key_version; bpage->real_size = page_size.physical(); diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 0169a63e972..ef8c2177b2c 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -219,6 +219,7 @@ buf_LRU_evict_from_unzip_LRU( return(unzip_avg <= io_avg * BUF_LRU_IO_TO_UNZIP_FACTOR); } +#ifdef BTR_CUR_HASH_ADAPT /** Attempts to drop page hash index on a batch of pages belonging to a particular space id. @param[in] space_id space id @@ -364,6 +365,7 @@ next_page: buf_LRU_drop_page_hash_batch(id, page_size, page_arr, num_entries); ut_free(page_arr); } +#endif /* BTR_CUR_HASH_ADAPT */ /******************************************************************//** While flushing (or removing dirty) pages from a tablespace we don't @@ -788,7 +790,7 @@ scan_again: bpage->id.space(), bpage->id.page_no(), bpage->state)); - +#ifdef BTR_CUR_HASH_ADAPT if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) { /* Do nothing, because the adaptive hash index covers uncompressed pages only. */ @@ -810,6 +812,7 @@ scan_again: goto scan_again; } +#endif /* BTR_CUR_HASH_ADAPT */ if (bpage->oldest_modification != 0) { @@ -911,7 +914,7 @@ buf_LRU_flush_or_remove_pages( buf_pool_t* buf_pool; buf_pool = buf_pool_from_array(i); - +#ifdef BTR_CUR_HASH_ADAPT switch (buf_remove) { case BUF_REMOVE_ALL_NO_WRITE: buf_LRU_drop_page_hash_for_tablespace(buf_pool, id); @@ -927,7 +930,7 @@ buf_LRU_flush_or_remove_pages( table, there is no need to drop the AHI entries. */ break; } - +#endif /* BTR_CUR_HASH_ADAPT */ buf_LRU_remove_pages(buf_pool, id, buf_remove, trx); } } @@ -1206,15 +1209,15 @@ buf_LRU_check_size_of_non_data_objects( + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->curr_size / 20) { ib::fatal() << "Over 95 percent of the buffer pool is" - " occupied by lock heaps or the adaptive hash index!" + " occupied by lock heaps" +#ifdef BTR_CUR_HASH_ADAPT + " or the adaptive hash index!" +#endif /* BTR_CUR_HASH_ADAPT */ " Check that your transactions do not set too many" - " row locks. Your buffer pool size is " - << (buf_pool->curr_size - / (1024 * 1024 / UNIV_PAGE_SIZE)) << " MB." - " Maybe you should make the buffer pool bigger?" - " We intentionally generate a seg fault to print" - " a stack trace on Linux!"; - + " row locks, or review if" + " innodb_buffer_pool_size=" + << (buf_pool->curr_size >> (20 - UNIV_PAGE_SIZE_SHIFT)) + << "M could be bigger."; } else if (!recv_recovery_is_on() && buf_pool->curr_size == buf_pool->old_size && (UT_LIST_GET_LEN(buf_pool->free) @@ -1228,16 +1231,17 @@ buf_LRU_check_size_of_non_data_objects( leak! */ ib::warn() << "Over 67 percent of the buffer pool is" - " occupied by lock heaps or the adaptive hash" - " index! Check that your transactions do not" - " set too many row locks. Your buffer pool" - " size is " - << (buf_pool->curr_size - / (1024 * 1024 / UNIV_PAGE_SIZE)) - << " MB. Maybe you should make the buffer pool" - " bigger?. Starting the InnoDB Monitor to print" - " diagnostics, including lock heap and hash" - " index sizes."; + " occupied by lock heaps" +#ifdef BTR_CUR_HASH_ADAPT + " or the adaptive hash index!" +#endif /* BTR_CUR_HASH_ADAPT */ + " Check that your transactions do not" + " set too many row locks." + " innodb_buffer_pool_size=" + << (buf_pool->curr_size >> + (20 - UNIV_PAGE_SIZE_SHIFT)) << "M." + " Starting the InnoDB Monitor to print" + " diagnostics."; buf_lru_switched_on_innodb_mon = true; srv_print_innodb_monitor = TRUE; @@ -2103,9 +2107,11 @@ buf_LRU_block_free_non_file_page( return; /* Continue */ } -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ut_a(block->n_pointers == 0); -#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ ut_ad(!block->page.in_free_list); ut_ad(!block->page.in_flush_list); ut_ad(!block->page.in_LRU_list); diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc index 0ccf5868d14..c897564c1d4 100644 --- a/storage/innobase/data/data0data.cc +++ b/storage/innobase/data/data0data.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -728,7 +729,7 @@ skip_field: DEBUG_SYNC_C("ib_mv_nonupdated_column_offpage"); upd_field_t upd_field; - upd_field.field_no = longest_i; + upd_field.field_no = unsigned(longest_i); upd_field.orig_len = 0; upd_field.exp = NULL; upd_field.old_v_val = NULL; diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc index cad165d1489..7da473f0a3e 100644 --- a/storage/innobase/data/data0type.cc +++ b/storage/innobase/data/data0type.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -140,23 +141,6 @@ dtype_is_non_binary_string_type( } /*********************************************************************//** -Forms a precise type from the < 4.1.2 format precise type plus the -charset-collation code. -@return precise type, including the charset-collation code */ -ulint -dtype_form_prtype( -/*==============*/ - ulint old_prtype, /*!< in: the MySQL type code and the flags - DATA_BINARY_TYPE etc. */ - ulint charset_coll) /*!< in: MySQL charset-collation code */ -{ - ut_a(old_prtype < 256 * 256); - ut_a(charset_coll <= MAX_CHAR_COLL_NUM); - - return(old_prtype + (charset_coll << 16)); -} - -/*********************************************************************//** Validates a data type structure. @return TRUE if ok */ ibool diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 943b79c3514..32c1a12ec1e 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -264,13 +264,11 @@ dict_get_db_name_len( return(s - name); } -/********************************************************************//** -Reserves the dictionary system mutex for MySQL. */ +/** Reserve the dictionary system mutex. */ void -dict_mutex_enter_for_mysql_func(const char * file, ulint line) -/*============================*/ +dict_mutex_enter_for_mysql_func(const char *file, unsigned line) { - mutex_enter(&dict_sys->mutex); + mutex_enter_loc(&dict_sys->mutex, file, line); } /********************************************************************//** @@ -1316,7 +1314,7 @@ void dict_table_add_to_cache( /*====================*/ dict_table_t* table, /*!< in: table */ - ibool can_be_evicted, /*!< in: TRUE if can be evicted */ + bool can_be_evicted, /*!< in: whether can be evicted */ mem_heap_t* heap) /*!< in: temporary heap */ { ulint fold; @@ -1407,8 +1405,6 @@ dict_table_can_be_evicted( ut_a(table->referenced_set.empty()); if (table->get_ref_count() == 0) { - dict_index_t* index; - /* The transaction commit and rollback are called from outside the handler interface. This means that there is a window where the table->n_ref_count can be zero but @@ -1418,7 +1414,8 @@ dict_table_can_be_evicted( return(FALSE); } - for (index = dict_table_get_first_index(table); +#ifdef BTR_CUR_HASH_ADAPT + for (dict_index_t* index = dict_table_get_first_index(table); index != NULL; index = dict_table_get_next_index(index)) { @@ -1440,6 +1437,7 @@ dict_table_can_be_evicted( return(FALSE); } } +#endif /* BTR_CUR_HASH_ADAPT */ return(TRUE); } @@ -2611,9 +2609,11 @@ dict_index_add_to_cache_w_vcol( UT_LIST_ADD_LAST(table->indexes, new_index); new_index->table = table; new_index->table_name = table->name.m_name; +#ifdef BTR_CUR_ADAPT new_index->search_info = btr_search_info_create(new_index->heap); +#endif /* BTR_CUR_ADAPT */ - new_index->page = page_no; + new_index->page = unsigned(page_no); rw_lock_create(index_tree_rw_lock_key, &new_index->lock, SYNC_INDEX_TREE); @@ -2636,8 +2636,6 @@ dict_index_remove_from_cache_low( to make room in the table LRU list */ { lint size; - ulint retries = 0; - btr_search_t* info; ut_ad(table && index); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); @@ -2652,9 +2650,11 @@ dict_index_remove_from_cache_low( row_log_free(index->online_log); } +#ifdef BTR_CUR_HASH_ADAPT /* We always create search info whether or not adaptive hash index is enabled or not. */ - info = btr_search_get_info(index); + btr_search_t* info = btr_search_get_info(index); + ulint retries = 0; ut_ad(info); /* We are not allowed to free the in-memory index struct @@ -2688,10 +2688,9 @@ dict_index_remove_from_cache_low( /* To avoid a hang here we commit suicide if the ref_count doesn't drop to zero in 600 seconds. */ - if (retries >= 60000) { - ut_error; - } + ut_a(retries < 60000); } while (srv_shutdown_state == SRV_SHUTDOWN_NONE || !lru_evict); +#endif /* BTR_CUR_HASH_ADAPT */ rw_lock_free(&index->lock); @@ -3178,7 +3177,7 @@ dict_index_build_internal_clust( can theoretically occur. Check for it. */ fixed_size += new_index->trx_id_offset; - new_index->trx_id_offset = fixed_size; + new_index->trx_id_offset = unsigned(fixed_size); if (new_index->trx_id_offset != fixed_size) { /* Overflow. Pretend that this is a diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index db14983cd8f..203185d55a5 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1822,8 +1822,8 @@ dict_load_field_low( { const byte* field; ulint len; - ulint pos_and_prefix_len; - ulint prefix_len; + unsigned pos_and_prefix_len; + unsigned prefix_len; ibool first_field; ulint position; @@ -2027,7 +2027,7 @@ dict_load_index_low( ulint n_fields; ulint type; ulint space; - ulint merge_threshold; + unsigned merge_threshold; if (allocate) { /* If allocate=TRUE, no dict_index_t will diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 9463c5103ca..f4dbbf026aa 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -2,6 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. +Copyright (c) 2017, 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 @@ -1114,12 +1115,12 @@ dict_mem_table_is_system( /* table has the following format: database/table and some system table are of the form SYS_* */ if (strchr(name, '/')) { - int table_len = strlen(name); + size_t table_len = strlen(name); const char *system_db; int i = 0; while ((system_db = innobase_system_databases[i++]) && (system_db != NullS)) { - int len = strlen(system_db); + size_t len = strlen(system_db); if (table_len > len && !strncmp(name, system_db, len)) { return true; } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index ac1978f2673..ccec6191ed4 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1727,7 +1727,7 @@ fil_crypt_get_page_throttle_func( mtr_t* mtr, /*!< in/out: minitransaction */ ulint* sleeptime_ms, /*!< out: sleep time */ const char* file, /*!< in: file name */ - ulint line) /*!< in: file line */ + unsigned line) /*!< in: file line */ { const page_id_t& page_id = page_id_t(space, offset); dberr_t err = DB_SUCCESS; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 1ef209ed0ed..5a7a33f67e3 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -584,7 +584,9 @@ fil_node_open_file( read_only_mode = !fsp_is_system_temporary(space->id) && srv_read_only_mode; - if (node->size == 0 + const bool first_time_open = node->size == 0; + + if (first_time_open || (space->purpose == FIL_TYPE_TABLESPACE && node == UT_LIST_GET_FIRST(space->chain) && !undo::Truncate::was_tablespace_truncated(space->id) @@ -689,7 +691,7 @@ retry: space->free_limit = free_limit; space->free_len = free_len; - if (node->size == 0) { + if (first_time_open) { ulint extent_size; extent_size = psize * FSP_EXTENT_SIZE; @@ -727,24 +729,21 @@ retry: innodb_data_file_key, node->name, OS_FILE_OPEN, OS_FILE_AIO, OS_DATA_FILE, read_only_mode, &success); - if (!space->atomic_write_tested) - { - const page_size_t page_size(space->flags); - - space->atomic_write_tested= 1; - /* - Atomic writes is supported if the file can be used - with atomic_writes (not log file), O_DIRECT is - used (tested in ha_innodbc.cc) and the file is - device and file system that supports atomic writes - for the given block size - */ - space->atomic_write_supported= - srv_use_atomic_writes && - node->atomic_write && - my_test_if_atomic_write(node->handle, - page_size.physical()) ? - true : false; + if (first_time_open) { + /* + Atomic writes is supported if the file can be used + with atomic_writes (not log file), O_DIRECT is + used (tested in ha_innodb.cc) and the file is + device and file system that supports atomic writes + for the given block size + */ + space->atomic_write_supported + = srv_use_atomic_writes + && node->atomic_write + && my_test_if_atomic_write( + node->handle, + int(page_size_t(space->flags) + .physical())); } } @@ -1302,7 +1301,7 @@ fil_mutex_enter_and_prepare_for_io( } } - if (ulint size = UNIV_UNLIKELY(space->recv_size)) { + if (ulint size = ulint(UNIV_UNLIKELY(space->recv_size))) { ut_ad(node); bool success; if (fil_space_extend_must_retry(space, node, size, diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index 18f95c94d75..1eb9ec37f5d 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -99,7 +99,7 @@ fil_compress_page( byte* lzo_mem) /*!< in: temporal memory used by LZO */ { int err = Z_OK; - int comp_level = level; + int comp_level = int(level); ulint header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE; ulint write_size=0; /* Cache to avoid change during function execution */ diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 6886c5164f7..80a2aa211db 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -3060,7 +3060,9 @@ fseg_free_page_low( fil_space_t* space, page_no_t offset, const page_size_t& page_size, +#ifdef BTR_CUR_HASH_ADAPT bool ahi, +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) { xdes_t* descr; @@ -3076,7 +3078,7 @@ fseg_free_page_low( == FSEG_MAGIC_N_VALUE); ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); ut_d(fsp_space_modify_check(space, mtr)); - +#ifdef BTR_CUR_HASH_ADAPT /* Drop search system page hash index if the page is found in the pool and is hashed */ @@ -3084,6 +3086,7 @@ fseg_free_page_low( btr_search_drop_page_hash_when_freed( page_id_t(space->id, offset), page_size); } +#endif /* BTR_CUR_HASH_ADAPT */ descr = xdes_get_descriptor(space, offset, page_size, mtr); @@ -3168,16 +3171,22 @@ fseg_free_page_low( } } +#ifndef BTR_CUR_HASH_ADAPT +# define fseg_free_page_low(inode, space, offset, page_size, ahi, mtr) \ + fseg_free_page_low(inode, space, offset, page_size, mtr) +#endif /* !BTR_CUR_HASH_ADAPT */ + /**********************************************************************//** Frees a single page of a segment. */ void -fseg_free_page( -/*===========*/ +fseg_free_page_func( fseg_header_t* seg_header, /*!< in: segment header */ ulint space_id,/*!< in: space id */ ulint page, /*!< in: page offset */ +#ifdef BTR_CUR_HASH_ADAPT bool ahi, /*!< in: whether we may need to drop the adaptive hash index */ +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) /*!< in/out: mini-transaction */ { DBUG_ENTER("fseg_free_page"); @@ -3253,7 +3262,9 @@ fseg_free_extent( fil_space_t* space, const page_size_t& page_size, ulint page, +#ifdef BTR_CUR_HASH_ADAPT bool ahi, +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) { ulint first_page_in_extent; @@ -3274,6 +3285,7 @@ fseg_free_extent( first_page_in_extent = page - (page % FSP_EXTENT_SIZE); +#ifdef BTR_CUR_HASH_ADAPT if (ahi) { for (i = 0; i < FSP_EXTENT_SIZE; i++) { if (!xdes_mtr_get_bit(descr, XDES_FREE_BIT, i, mtr)) { @@ -3289,6 +3301,7 @@ fseg_free_extent( } } } +#endif /* BTR_CUR_HASH_ADAPT */ if (xdes_is_full(descr, mtr)) { flst_remove(seg_inode + FSEG_FULL, @@ -3321,6 +3334,11 @@ fseg_free_extent( #endif /* UNIV_DEBUG */ } +#ifndef BTR_CUR_HASH_ADAPT +# define fseg_free_extent(inode, space, page_size, page, ahi, mtr) \ + fseg_free_extent(inode, space, page_size, page, mtr) +#endif /* !BTR_CUR_HASH_ADAPT */ + /**********************************************************************//** Frees part of a segment. This function can be used to free a segment by repeatedly calling this function in different mini-transactions. Doing @@ -3328,14 +3346,15 @@ the freeing in a single mini-transaction might result in too big a mini-transaction. @return TRUE if freeing completed */ ibool -fseg_free_step( -/*===========*/ +fseg_free_step_func( fseg_header_t* header, /*!< in, own: segment header; NOTE: if the header resides on the first page of the frag list of the segment, this pointer becomes obsolete after the last freeing step */ +#ifdef BTR_CUR_HASH_ADAPT bool ahi, /*!< in: whether we may need to drop the adaptive hash index */ +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) /*!< in/out: mini-transaction */ { ulint n; @@ -3414,12 +3433,13 @@ Frees part of a segment. Differs from fseg_free_step because this function leaves the header page unfreed. @return TRUE if freeing completed, except the header page */ ibool -fseg_free_step_not_header( -/*======================*/ +fseg_free_step_not_header_func( fseg_header_t* header, /*!< in: segment header which must reside on the first fragment page of the segment */ +#ifdef BTR_CUR_HASH_ADAPT bool ahi, /*!< in: whether we may need to drop the adaptive hash index */ +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) /*!< in/out: mini-transaction */ { ulint n; @@ -3735,7 +3755,7 @@ fsp_page_is_free_func( ulint page_no, /*!< in: page offset */ mtr_t* mtr, /*!< in/out: mini-transaction */ const char *file, - ulint line) + unsigned line) { ut_ad(mtr); diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 0bc96199486..f23065ae3c7 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -542,7 +542,7 @@ rtr_pcur_open_low( ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { btr_cur_t* btr_cursor; @@ -718,7 +718,7 @@ rtr_page_get_father_node_ptr_func( out: cursor on node pointer record, its page x-latched */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dtuple_t* tuple; @@ -1262,7 +1262,7 @@ rtr_cur_restore_position_func( btr_cur_t* btr_cur, /*!< in: detached persistent cursor */ ulint level, /*!< in: index level */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dict_index_t* index; @@ -1553,6 +1553,7 @@ rtr_copy_buf( /* Skip buf_block_t::lock */ matches->block.lock_hash_val = block->lock_hash_val; matches->block.modify_clock = block->modify_clock; +#ifdef BTR_CUR_HASH_ADAPT matches->block.n_hash_helps = block->n_hash_helps; matches->block.n_fields = block->n_fields; matches->block.left_side = block->left_side; @@ -1562,7 +1563,7 @@ rtr_copy_buf( matches->block.curr_n_fields = block->curr_n_fields; matches->block.curr_left_side = block->curr_left_side; matches->block.index = block->index; - +#endif /* BTR_CUR_HASH_ADAPT */ ut_d(matches->block.debug_latch = block->debug_latch); } diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc index cf92f22ac15..1f90738c75f 100644 --- a/storage/innobase/ha/ha0ha.cc +++ b/storage/innobase/ha/ha0ha.cc @@ -146,7 +146,9 @@ ha_clear( hash_table_t* table) /*!< in, own: hash table */ { ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); +#ifdef BTR_CUR_HASH_ADAPT ut_ad(!table->adaptive || btr_search_own_all(RW_LOCK_X)); +#endif /* BTR_CUR_HASH_ADAPT */ for (ulint i = 0; i < table->n_sync_obj; i++) { mem_heap_free(table->heaps[i]); @@ -189,6 +191,7 @@ ha_clear( } } +#ifdef BTR_CUR_HASH_ADAPT /*************************************************************//** Inserts an entry into a hash table. If an entry with the same fold number is found, its node is updated to point to the new data, and no new node @@ -536,3 +539,4 @@ builds, see http://bugs.mysql.com/36941 */ (ulong) n_bufs); } } +#endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/ha/hash0hash.cc b/storage/innobase/ha/hash0hash.cc index 7c5798ae254..ef1339ff47b 100644 --- a/storage/innobase/ha/hash0hash.cc +++ b/storage/innobase/ha/hash0hash.cc @@ -273,9 +273,11 @@ hash_create( table->type = HASH_TABLE_SYNC_NONE; table->array = array; table->n_cells = prime; -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG table->adaptive = FALSE; -#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ table->n_sync_obj = 0; table->sync_obj.mutexes = NULL; table->heaps = NULL; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ded2105da05..8f1e7657d1d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -640,25 +640,6 @@ static PSI_file_info all_innodb_files[] = { # endif /* UNIV_PFS_IO */ #endif /* HAVE_PSI_INTERFACE */ -/******************************************************************//** -Debug function used to read a MBR data */ - -#ifdef UNIV_DEBUG -void -srv_mbr_debug(const byte* data) -{ - double a, b, c , d; - a = mach_double_read(data); - data += sizeof(double); - b = mach_double_read(data); - data += sizeof(double); - c = mach_double_read(data); - data += sizeof(double); - d = mach_double_read(data); - ut_ad(a && b && c &&d); -} -#endif - static void innodb_remember_check_sysvar_funcs(); mysql_var_check_func check_sysvar_enum; @@ -1839,11 +1820,13 @@ innobase_srv_conc_exit_innodb( #endif /* WITH_WSREP */ trx_t* trx = prebuilt->trx; -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ /* This is to avoid making an unnecessary function call. */ if (trx->declared_to_be_inside_innodb @@ -1861,11 +1844,13 @@ innobase_srv_conc_force_exit_innodb( /*================================*/ trx_t* trx) /*!< in: transaction handle */ { -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ /* This is to avoid making an unnecessary function call. */ if (trx->declared_to_be_inside_innodb) { @@ -1943,12 +1928,13 @@ const char* thd_innodb_tmpdir( THD* thd) { - -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG trx_t* trx = thd_to_trx(thd); btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ const char* tmp_dir = THDVAR(thd, tmpdir); @@ -1999,7 +1985,7 @@ innobase_release_temporary_latches( if (!srv_was_started) { } else if (trx_t* trx = thd_to_trx(thd)) { - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); } return(0); @@ -3324,7 +3310,6 @@ innobase_query_caching_of_table_permitted( to the table */ ulonglong *unused) /*!< unused for this engine */ { - bool is_autocommit; char norm_name[1000]; trx_t* trx = check_trx_exists(thd); @@ -3334,29 +3319,14 @@ innobase_query_caching_of_table_permitted( /* In the SERIALIZABLE mode we add LOCK IN SHARE MODE to every plain SELECT if AUTOCOMMIT is not on. */ - return(static_cast<my_bool>(false)); - } - - if (trx->has_search_latch) { - sql_print_error("The calling thread is holding the adaptive" - " search, latch though calling" - " innobase_query_caching_of_table_permitted."); - trx_print(stderr, trx, 1024); + return(false); } - trx_search_latch_release_if_reserved(trx); - + trx_assert_no_search_latch(trx); innobase_srv_conc_force_exit_innodb(trx); - if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - - is_autocommit = true; - } else { - is_autocommit = false; - - } - - if (is_autocommit && trx->n_mysql_tables_in_use == 0) { + if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) + && trx->n_mysql_tables_in_use == 0) { /* We are going to retrieve the query result from the query cache. This cannot be a store operation to the query cache because then MySQL would have locks on tables already. @@ -3375,7 +3345,7 @@ innobase_query_caching_of_table_permitted( then trx2 would have already invalidated the cache. Thus we can trust the result in the cache is ok for this query. */ - return((my_bool)TRUE); + return(true); } /* Normalize the table name to InnoDB format */ @@ -3383,12 +3353,7 @@ innobase_query_caching_of_table_permitted( innobase_register_trx(innodb_hton_ptr, thd, trx); - if (row_search_check_if_query_cache_permitted(trx, norm_name)) { - - return(static_cast<my_bool>(true)); - } - - return(static_cast<my_bool>(false)); + return(row_search_check_if_query_cache_permitted(trx, norm_name)); } /*****************************************************************//** @@ -3640,7 +3605,7 @@ ha_innobase::init_table_handle_for_HANDLER(void) /* Initialize the m_prebuilt struct much like it would be inited in external_lock */ - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); innobase_srv_conc_force_exit_innodb(m_prebuilt->trx); @@ -3751,7 +3716,15 @@ static const char* deprecated_file_format_max /** Deprecation message about innodb_use_trim */ static const char* deprecated_use_trim - = DEPRECATED_FORMAT_PARAMETER("innodb_use_trim"); + = "Using innodb_use_trim is deprecated" + " and the parameter will be removed in MariaDB 10.3."; + +/** Deprecation message about innodb_instrument_semaphores */ +static const char* deprecated_instrument_semaphores + = "Using innodb_instrument_semaphores is deprecated" + " and the parameter will be removed in MariaDB 10.3."; + +static my_bool innodb_instrument_semaphores; /** Update log_checksum_algorithm_ptr with a pointer to the function corresponding to whether checksums are enabled. @@ -4108,6 +4081,10 @@ innobase_init( ib::warn() << deprecated_file_format; } + if (innodb_instrument_semaphores) { + ib::warn() << deprecated_instrument_semaphores; + } + /* Validate the file format by animal name */ if (innobase_file_format_name != NULL) { @@ -4342,8 +4319,8 @@ innobase_change_buffering_inited_ok: " It will be removed in MariaDB 10.3."; } - srv_use_atomic_writes = (ibool) (innobase_use_atomic_writes && - my_may_have_atomic_write); + srv_use_atomic_writes + = innobase_use_atomic_writes && my_may_have_atomic_write; if (srv_use_atomic_writes && !srv_file_per_table) { fprintf(stderr, "InnoDB: Disabling atomic_writes as file_per_table is not used.\n"); @@ -4760,7 +4737,7 @@ innobase_commit_ordered( search system latch, or we will disobey the latching order. But we already released it in innobase_xa_prepare() (if not before), so just have an assert here.*/ - ut_ad(!trx->has_search_latch); + trx_assert_no_search_latch(trx); if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { /* We cannot throw error here; instead we will catch this error @@ -4979,7 +4956,7 @@ innobase_rollback_trx( reserve the trx_sys->mutex, we have to release the search system latch first to obey the latching order. */ - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); innobase_srv_conc_force_exit_innodb(trx); @@ -10073,7 +10050,7 @@ ha_innobase::innobase_get_index( << " InnoDB name " << index->name() << " for table " << m_prebuilt->table->name.m_name; - for(ulint i=0; i < table->s->keys; i++) { + for(uint i=0; i < table->s->keys; i++) { index = innobase_index_lookup(m_share, i); key = table->key_info + keynr; @@ -13098,7 +13075,7 @@ create_table_info_t::initialize() /* In case MySQL calls this in the middle of a SELECT query, release possible adaptive hash latch to avoid deadlocks of threads */ - trx_search_latch_release_if_reserved(parent_trx); + trx_assert_no_search_latch(parent_trx); DBUG_RETURN(0); } @@ -13946,16 +13923,11 @@ innobase_drop_database( THD* thd = current_thd; - /* In the Windows plugin, thd = current_thd is always NULL */ - if (thd != NULL) { - trx_t* parent_trx = check_trx_exists(thd); - - /* In case MySQL calls this in the middle of a SELECT - query, release possible adaptive hash latch to avoid - deadlocks of threads */ + /* In case MySQL calls this in the middle of a SELECT + query, release possible adaptive hash latch to avoid + deadlocks of threads */ - trx_search_latch_release_if_reserved(parent_trx); - } + trx_assert_no_search_latch(check_trx_exists(thd)); ulint len = 0; char* ptr = strend(path) - 2; @@ -14805,7 +14777,7 @@ ha_innobase::info_low( m_prebuilt->trx->op_info = (char*)"returning various info to MariaDB"; - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); ib_table = m_prebuilt->table; DBUG_ASSERT(ib_table->n_ref_count > 0); @@ -15590,7 +15562,8 @@ ha_innobase::check( /* Restore the original isolation level */ m_prebuilt->trx->isolation_level = old_isolation_level; -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG /* We validate the whole adaptive hash index for all tables at every CHECK TABLE only when QUICK flag is not present. */ @@ -15600,7 +15573,8 @@ ha_innobase::check( "InnoDB: The adaptive hash index is corrupted."); is_ok = false; } -#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ +# endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ m_prebuilt->trx->op_info = ""; DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT); @@ -15637,7 +15611,7 @@ ha_innobase::update_table_comment( /* In case MySQL calls this in the middle of a SELECT query, release possible adaptive hash latch to avoid deadlocks of threads */ - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); #define SSTR( x ) reinterpret_cast< std::ostringstream & >( \ ( std::ostringstream() << std::dec << x ) ).str() @@ -15699,7 +15673,7 @@ ha_innobase::get_foreign_key_create_info(void) release possible adaptive hash latch to avoid deadlocks of threads */ - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); @@ -16698,7 +16672,7 @@ innodb_show_status( trx_t* trx = check_trx_exists(thd); - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); innobase_srv_conc_force_exit_innodb(trx); @@ -17990,7 +17964,7 @@ innobase_xa_prepare( reserve the trx_sys->mutex, we have to release the search system latch first to obey the latching order. */ - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); innobase_srv_conc_force_exit_innodb(trx); @@ -18733,6 +18707,7 @@ innodb_internal_table_validate( return(ret); } +#ifdef BTR_CUR_HASH_ADAPT /****************************************************************//** Update the system variable innodb_adaptive_hash_index using the "saved" value. This function is registered as a callback with MySQL. */ @@ -18754,6 +18729,7 @@ innodb_adaptive_hash_index_update( btr_search_disable(true); } } +#endif /* BTR_CUR_HASH_ADAPT */ /****************************************************************//** Update the system variable innodb_cmp_per_index using the "saved" @@ -20620,6 +20596,25 @@ innodb_use_trim_update( HA_ERR_WRONG_COMMAND, deprecated_use_trim); } +/** Update the innodb_instrument_sempahores parameter. +@param[in] thd thread handle +@param[in] var system variable +@param[out] var_ptr current value +@param[in] save immediate result from check function */ +static +void +innodb_instrument_semaphores_update( + THD* thd, + struct st_mysql_sys_var* var, + void* var_ptr, + const void* save) +{ + innodb_instrument_semaphores = *static_cast<const my_bool*>(save); + + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_WRONG_COMMAND, deprecated_instrument_semaphores); +} + /* plugin options */ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm, @@ -20963,6 +20958,7 @@ static MYSQL_SYSVAR_BOOL(stats_traditional, srv_stats_sample_traditional, "Enable traditional statistic calculation based on number of configured pages (default true)", NULL, NULL, TRUE); +#ifdef BTR_CUR_HASH_ADAPT static MYSQL_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled, PLUGIN_VAR_OPCMDARG, "Enable InnoDB adaptive hash index (enabled by default). " @@ -20974,8 +20970,9 @@ Each partition is protected by its own latch and so we have parts number of latches protecting complete search system. */ static MYSQL_SYSVAR_ULONG(adaptive_hash_index_parts, btr_ahi_parts, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, - "Number of InnoDB Adapative Hash Index Partitions. (default = 8). ", + "Number of InnoDB Adaptive Hash Index Partitions (default 8)", NULL, NULL, 8, 1, 512, 0); +#endif /* BTR_CUR_HASH_ADAPT */ static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay, PLUGIN_VAR_RQCMDARG, @@ -21833,11 +21830,10 @@ static MYSQL_SYSVAR_BOOL(debug_force_scrubbing, NULL, NULL, FALSE); #endif /* UNIV_DEBUG */ -static MYSQL_SYSVAR_BOOL(instrument_semaphores, srv_instrument_semaphores, +static MYSQL_SYSVAR_BOOL(instrument_semaphores, innodb_instrument_semaphores, PLUGIN_VAR_OPCMDARG, - "Enable semaphore request instrumentation. This could have some effect on performance but allows better" - " information on long semaphore wait problems. (Default: not enabled)", - 0, 0, FALSE); + "DEPRECATED. This setting has no effect.", + NULL, innodb_instrument_semaphores_update, FALSE); static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(autoextend_increment), @@ -21932,8 +21928,10 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(stats_auto_recalc), MYSQL_SYSVAR(stats_modified_counter), MYSQL_SYSVAR(stats_traditional), +#ifdef BTR_CUR_HASH_ADAPT MYSQL_SYSVAR(adaptive_hash_index), MYSQL_SYSVAR(adaptive_hash_index_parts), +#endif /* BTR_CUR_HASH_ADAPT */ MYSQL_SYSVAR(stats_method), MYSQL_SYSVAR(replication_delay), MYSQL_SYSVAR(status_file), diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc index 6cdbd226b24..806a4079326 100644 --- a/storage/innobase/handler/ha_innopart.cc +++ b/storage/innobase/handler/ha_innopart.cc @@ -3070,7 +3070,7 @@ ha_innopart::records_in_range( /* In case MySQL calls this in the middle of a SELECT query, release possible adaptive hash latch to avoid deadlocks of threads. */ - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); active_index = keynr; @@ -3209,7 +3209,7 @@ ha_innopart::estimate_rows_upper_bound() /* In case MySQL calls this in the middle of a SELECT query, release possible adaptive hash latch to avoid deadlocks of threads. */ - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); for (uint i = m_part_info->get_first_used_partition(); i < m_tot_parts; @@ -3327,7 +3327,7 @@ ha_innopart::info_low( m_prebuilt->trx->op_info = (char*)"returning various info to MySQL"; - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); ut_ad(m_part_share->get_table_part(0)->n_ref_count > 0); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index d766dd6ada6..82fa4b724f4 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -589,7 +589,7 @@ ha_innobase::check_if_supported_inplace_alter( } update_thd(); - trx_search_latch_release_if_reserved(m_prebuilt->trx); + trx_assert_no_search_latch(m_prebuilt->trx); /* Change on engine specific table options require rebuild of the table */ @@ -5019,7 +5019,7 @@ op_ok: ctx->prebuilt->trx->mysql_thd) ? DB_SUCCESS : DB_ERROR; ctx->new_table->fts->fts_status - &= ~TABLE_DICT_LOCKED; + &= ulint(~TABLE_DICT_LOCKED); if (error != DB_SUCCESS) { goto error_handling; @@ -8802,11 +8802,12 @@ foreign_fail: DBUG_ASSERT(ctx0->old_table->get_ref_count() == 1); trx_commit_for_mysql(m_prebuilt->trx); - +#ifdef BTR_CUR_HASH_ADAPT if (btr_search_enabled) { btr_search_disable(false); btr_search_enable(); } +#endif /* BTR_CUR_HASH_ADAPT */ char tb_name[FN_REFLEN]; ut_strcpy(tb_name, m_prebuilt->table->name.m_name); diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index a400ee54758..dd43a52ae66 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -129,8 +129,10 @@ struct buf_page_info_t{ unsigned io_fix:2; /*!< type of pending I/O operation */ unsigned fix_count:19; /*!< Count of how manyfold this block is bufferfixed */ +#ifdef BTR_CUR_HASH_ADAPT unsigned hashed:1; /*!< Whether hash index has been built on this page */ +#endif /* BTR_CUR_HASH_ADAPT */ unsigned is_old:1; /*!< TRUE if the block is in the old blocks in buf_pool->LRU_old */ unsigned freed_page_clock:31; /*!< the value of @@ -339,6 +341,12 @@ field_store_ulint( return(ret); } +#ifdef BTR_CUR_HASH_ADAPT +# define I_S_AHI 1 /* Include the IS_HASHED column */ +#else +# define I_S_AHI 0 /* Omit the IS_HASHED column */ +#endif + /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */ static ST_FIELD_INFO innodb_trx_fields_info[] = { @@ -522,6 +530,7 @@ static ST_FIELD_INFO innodb_trx_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#ifdef BTR_CUR_HASH_ADAPT #define IDX_TRX_ADAPTIVE_HASH_LATCHED 20 {STRUCT_FLD(field_name, "trx_adaptive_hash_latched"), STRUCT_FLD(field_length, 1), @@ -530,17 +539,9 @@ static ST_FIELD_INFO innodb_trx_fields_info[] = STRUCT_FLD(field_flags, 0), STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#endif /* BTR_CUR_HASH_ADAPT */ -#define IDX_TRX_ADAPTIVE_HASH_TIMEOUT 21 - {STRUCT_FLD(field_name, "trx_adaptive_hash_timeout"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define IDX_TRX_READ_ONLY 22 +#define IDX_TRX_READ_ONLY 20 + I_S_AHI {STRUCT_FLD(field_name, "trx_is_read_only"), STRUCT_FLD(field_length, 1), STRUCT_FLD(field_type, MYSQL_TYPE_LONG), @@ -549,7 +550,7 @@ static ST_FIELD_INFO innodb_trx_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_TRX_AUTOCOMMIT_NON_LOCKING 23 +#define IDX_TRX_AUTOCOMMIT_NON_LOCKING 21 + I_S_AHI {STRUCT_FLD(field_name, "trx_autocommit_non_locking"), STRUCT_FLD(field_length, 1), STRUCT_FLD(field_type, MYSQL_TYPE_LONG), @@ -696,9 +697,11 @@ fill_innodb_trx_from_cache( OK(field_store_string(fields[IDX_TRX_LAST_FOREIGN_KEY_ERROR], row->trx_foreign_key_error)); +#ifdef BTR_CUR_HASH_ADAPT /* trx_adaptive_hash_latched */ OK(fields[IDX_TRX_ADAPTIVE_HASH_LATCHED]->store( row->trx_has_search_latch, true)); +#endif /* BTR_CUR_HASH_ADAPT */ /* trx_is_read_only*/ OK(fields[IDX_TRX_READ_ONLY]->store( @@ -947,8 +950,7 @@ fill_innodb_locks_from_cache( strlen(row->lock_table), thd); OK(fields[IDX_LOCK_TABLE]->store( - buf, static_cast<size_t>(bufend - buf), - system_charset_info)); + buf, uint(bufend - buf), system_charset_info)); /* lock_index */ if (row->lock_index != NULL) { @@ -2591,7 +2593,7 @@ i_s_metrics_fill( } else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE) && !(monitor_info->monitor_type & MONITOR_DISPLAY_CURRENT)) { - if (time_diff) { + if (time_diff != 0) { OK(fields[METRIC_AVG_VALUE_START]->store( (double) MONITOR_VALUE_SINCE_START( count) / time_diff)); @@ -2616,7 +2618,7 @@ i_s_metrics_fill( time_diff = 0; } - if (time_diff) { + if (time_diff != 0) { OK(fields[METRIC_AVG_VALUE_RESET]->store( static_cast<double>( MONITOR_VALUE(count) / time_diff))); @@ -4710,6 +4712,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#ifdef BTR_CUR_HASH_ADAPT #define IDX_BUFFER_PAGE_HASHED 7 {STRUCT_FLD(field_name, "IS_HASHED"), STRUCT_FLD(field_length, 3), @@ -4718,8 +4721,9 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#endif /* BTR_CUR_HASH_ADAPT */ -#define IDX_BUFFER_PAGE_NEWEST_MOD 8 +#define IDX_BUFFER_PAGE_NEWEST_MOD 7 + I_S_AHI {STRUCT_FLD(field_name, "NEWEST_MODIFICATION"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4728,7 +4732,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_OLDEST_MOD 9 +#define IDX_BUFFER_PAGE_OLDEST_MOD 8 + I_S_AHI {STRUCT_FLD(field_name, "OLDEST_MODIFICATION"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4737,7 +4741,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_ACCESS_TIME 10 +#define IDX_BUFFER_PAGE_ACCESS_TIME 9 + I_S_AHI {STRUCT_FLD(field_name, "ACCESS_TIME"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4746,7 +4750,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_TABLE_NAME 11 +#define IDX_BUFFER_PAGE_TABLE_NAME 10 + I_S_AHI {STRUCT_FLD(field_name, "TABLE_NAME"), STRUCT_FLD(field_length, 1024), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -4755,7 +4759,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_INDEX_NAME 12 +#define IDX_BUFFER_PAGE_INDEX_NAME 11 + I_S_AHI {STRUCT_FLD(field_name, "INDEX_NAME"), STRUCT_FLD(field_length, 1024), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -4764,7 +4768,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_NUM_RECS 13 +#define IDX_BUFFER_PAGE_NUM_RECS 12 + I_S_AHI {STRUCT_FLD(field_name, "NUMBER_RECORDS"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4773,7 +4777,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_DATA_SIZE 14 +#define IDX_BUFFER_PAGE_DATA_SIZE 13 + I_S_AHI {STRUCT_FLD(field_name, "DATA_SIZE"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4782,7 +4786,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_ZIP_SIZE 15 +#define IDX_BUFFER_PAGE_ZIP_SIZE 14 + I_S_AHI {STRUCT_FLD(field_name, "COMPRESSED_SIZE"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4791,7 +4795,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_STATE 16 +#define IDX_BUFFER_PAGE_STATE 15 + I_S_AHI {STRUCT_FLD(field_name, "PAGE_STATE"), STRUCT_FLD(field_length, 64), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -4800,7 +4804,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_IO_FIX 17 +#define IDX_BUFFER_PAGE_IO_FIX 16 + I_S_AHI {STRUCT_FLD(field_name, "IO_FIX"), STRUCT_FLD(field_length, 64), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -4809,7 +4813,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_IS_OLD 18 +#define IDX_BUFFER_PAGE_IS_OLD 17 + I_S_AHI {STRUCT_FLD(field_name, "IS_OLD"), STRUCT_FLD(field_length, 3), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -4818,7 +4822,7 @@ static ST_FIELD_INFO i_s_innodb_buffer_page_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUFFER_PAGE_FREE_CLOCK 19 +#define IDX_BUFFER_PAGE_FREE_CLOCK 18 + I_S_AHI {STRUCT_FLD(field_name, "FREE_PAGE_CLOCK"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -4888,13 +4892,11 @@ i_s_innodb_buffer_page_fill( OK(fields[IDX_BUFFER_PAGE_FIX_COUNT]->store( page_info->fix_count)); - if (page_info->hashed) { - OK(field_store_string( - fields[IDX_BUFFER_PAGE_HASHED], "YES")); - } else { - OK(field_store_string( - fields[IDX_BUFFER_PAGE_HASHED], "NO")); - } +#ifdef BTR_CUR_HASH_ADAPT + OK(field_store_string( + fields[IDX_BUFFER_PAGE_HASHED], + page_info->hashed ? "YES" : "NO")); +#endif /* BTR_CUR_HASH_ADAPT */ OK(fields[IDX_BUFFER_PAGE_NEWEST_MOD]->store( page_info->newest_mod, true)); @@ -4928,7 +4930,7 @@ i_s_innodb_buffer_page_fill( OK(fields[IDX_BUFFER_PAGE_TABLE_NAME]->store( table_name, - static_cast<size_t>(table_name_end - table_name), + uint(table_name_end - table_name), system_charset_info)); fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull(); @@ -5050,7 +5052,7 @@ i_s_innodb_set_page_type( page_info->page_type = I_S_PAGE_TYPE_INDEX; } - page_info->data_size = (ulint)(page_header_get_field( + page_info->data_size = unsigned(page_header_get_field( page, PAGE_HEAP_TOP) - (page_is_comp(page) ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END) @@ -5144,7 +5146,9 @@ i_s_innodb_buffer_page_get_info( block = reinterpret_cast<const buf_block_t*>(bpage); frame = block->frame; +#ifdef BTR_CUR_HASH_ADAPT page_info->hashed = (block->index != NULL); +#endif /* BTR_CUR_HASH_ADAPT */ } else { ut_ad(page_info->zip_ssize); frame = bpage->zip.data; @@ -5425,6 +5429,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#ifdef BTR_CUR_HASH_ADAPT #define IDX_BUF_LRU_PAGE_HASHED 7 {STRUCT_FLD(field_name, "IS_HASHED"), STRUCT_FLD(field_length, 3), @@ -5433,8 +5438,9 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#endif /* BTR_CUR_HASH_ADAPT */ -#define IDX_BUF_LRU_PAGE_NEWEST_MOD 8 +#define IDX_BUF_LRU_PAGE_NEWEST_MOD 7 + I_S_AHI {STRUCT_FLD(field_name, "NEWEST_MODIFICATION"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5443,7 +5449,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_OLDEST_MOD 9 +#define IDX_BUF_LRU_PAGE_OLDEST_MOD 8 + I_S_AHI {STRUCT_FLD(field_name, "OLDEST_MODIFICATION"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5452,7 +5458,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_ACCESS_TIME 10 +#define IDX_BUF_LRU_PAGE_ACCESS_TIME 9 + I_S_AHI {STRUCT_FLD(field_name, "ACCESS_TIME"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5461,7 +5467,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_TABLE_NAME 11 +#define IDX_BUF_LRU_PAGE_TABLE_NAME 10 + I_S_AHI {STRUCT_FLD(field_name, "TABLE_NAME"), STRUCT_FLD(field_length, 1024), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -5470,7 +5476,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_INDEX_NAME 12 +#define IDX_BUF_LRU_PAGE_INDEX_NAME 11 + I_S_AHI {STRUCT_FLD(field_name, "INDEX_NAME"), STRUCT_FLD(field_length, 1024), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -5479,7 +5485,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_NUM_RECS 13 +#define IDX_BUF_LRU_PAGE_NUM_RECS 12 + I_S_AHI {STRUCT_FLD(field_name, "NUMBER_RECORDS"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5488,7 +5494,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_DATA_SIZE 14 +#define IDX_BUF_LRU_PAGE_DATA_SIZE 13 + I_S_AHI {STRUCT_FLD(field_name, "DATA_SIZE"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5497,7 +5503,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_ZIP_SIZE 15 +#define IDX_BUF_LRU_PAGE_ZIP_SIZE 14 + I_S_AHI {STRUCT_FLD(field_name, "COMPRESSED_SIZE"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5506,7 +5512,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_STATE 16 +#define IDX_BUF_LRU_PAGE_STATE 15 + I_S_AHI {STRUCT_FLD(field_name, "COMPRESSED"), STRUCT_FLD(field_length, 3), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -5515,7 +5521,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_IO_FIX 17 +#define IDX_BUF_LRU_PAGE_IO_FIX 16 + I_S_AHI {STRUCT_FLD(field_name, "IO_FIX"), STRUCT_FLD(field_length, 64), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -5524,7 +5530,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_IS_OLD 18 +#define IDX_BUF_LRU_PAGE_IS_OLD 17 + I_S_AHI {STRUCT_FLD(field_name, "IS_OLD"), STRUCT_FLD(field_length, 3), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -5533,7 +5539,7 @@ static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, -#define IDX_BUF_LRU_PAGE_FREE_CLOCK 19 +#define IDX_BUF_LRU_PAGE_FREE_CLOCK 18 + I_S_AHI {STRUCT_FLD(field_name, "FREE_PAGE_CLOCK"), STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), @@ -5606,13 +5612,11 @@ i_s_innodb_buf_page_lru_fill( OK(fields[IDX_BUF_LRU_PAGE_FIX_COUNT]->store( page_info->fix_count, true)); - if (page_info->hashed) { - OK(field_store_string( - fields[IDX_BUF_LRU_PAGE_HASHED], "YES")); - } else { - OK(field_store_string( - fields[IDX_BUF_LRU_PAGE_HASHED], "NO")); - } +#ifdef BTR_CUR_HASH_ADAPT + OK(field_store_string( + fields[IDX_BUF_LRU_PAGE_HASHED], + page_info->hashed ? "YES" : "NO")); +#endif /* BTR_CUR_HASH_ADAPT */ OK(fields[IDX_BUF_LRU_PAGE_NEWEST_MOD]->store( page_info->newest_mod, true)); @@ -5646,7 +5650,7 @@ i_s_innodb_buf_page_lru_fill( OK(fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->store( table_name, - static_cast<size_t>(table_name_end - table_name), + uint(table_name_end - table_name), system_charset_info)); fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull(); @@ -9150,7 +9154,8 @@ i_s_innodb_mutexes_fill_table( OK(field_store_string(fields[MUTEXES_NAME], mutex->cmutex_name)); OK(field_store_string(fields[MUTEXES_CREATE_FILE], innobase_basename(mutex->cfile_name))); - OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], mutex->cline)); + OK(fields[MUTEXES_CREATE_LINE]->store(mutex->cline, true)); + fields[MUTEXES_CREATE_LINE]->set_notnull(); OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)mutex->count_os_wait)); OK(schema_table_store_record(thd, tables->table)); } @@ -9163,7 +9168,8 @@ i_s_innodb_mutexes_fill_table( OK(field_store_string(fields[MUTEXES_NAME], block_mutex->cmutex_name)); OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1)); - OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], block_mutex->cline)); + OK(fields[MUTEXES_CREATE_LINE]->store(block_mutex->cline, true)); + fields[MUTEXES_CREATE_LINE]->set_notnull(); OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)block_mutex_oswait_count)); OK(schema_table_store_record(thd, tables->table)); } @@ -9187,7 +9193,8 @@ i_s_innodb_mutexes_fill_table( //OK(field_store_string(fields[MUTEXES_NAME], lock->lock_name)); OK(field_store_string(fields[MUTEXES_CREATE_FILE], innobase_basename(lock->cfile_name))); - OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], lock->cline)); + OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline, true)); + fields[MUTEXES_CREATE_LINE]->set_notnull(); OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)lock->count_os_wait)); OK(schema_table_store_record(thd, tables->table)); } @@ -9200,7 +9207,8 @@ i_s_innodb_mutexes_fill_table( //OK(field_store_string(fields[MUTEXES_NAME], block_lock->lock_name)); OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1)); - OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], block_lock->cline)); + OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline, true)); + fields[MUTEXES_CREATE_LINE]->set_notnull(); OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)block_lock_oswait_count)); OK(schema_table_store_record(thd, tables->table)); } diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index e6c36b425e6..3bc56c2d737 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -571,7 +571,9 @@ ibuf_init_at_db_start(void) ibuf->index->n_uniq = REC_MAX_N_FIELDS; rw_lock_create(index_tree_rw_lock_key, &ibuf->index->lock, SYNC_IBUF_INDEX_TREE); +#ifdef BTR_CUR_ADAPT ibuf->index->search_info = btr_search_info_create(ibuf->index->heap); +#endif /* BTR_CUR_ADAPT */ ibuf->index->page = FSP_IBUF_TREE_ROOT_PAGE_NO; ut_d(ibuf->index->cached = TRUE); return (error); @@ -808,7 +810,7 @@ ibuf_bitmap_get_map_page_func( const page_id_t& page_id, const page_size_t& page_size, const char* file, - ulint line, + unsigned line, mtr_t* mtr) { buf_block_t* block = NULL; @@ -1136,7 +1138,7 @@ ibuf_page_low( ibool x_latch, #endif /* UNIV_DEBUG */ const char* file, - ulint line, + unsigned line, mtr_t* mtr) { ibool ret; @@ -3954,7 +3956,9 @@ ibuf_insert_to_index_page( ut_ad(!dict_index_is_online_ddl(index));// this is an ibuf_dummy index ut_ad(ibuf_inside(mtr)); ut_ad(dtuple_check_typed(entry)); +#ifdef BTR_CUR_HASH_ADAPT ut_ad(!block->index); +#endif /* BTR_CUR_HASH_ADAPT */ ut_ad(mtr->is_named_space(block->page.id.space())); if (UNIV_UNLIKELY(dict_table_is_comp(index->table) diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 419c5db657d..4a80b5e4913 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2016, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 2017, 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 @@ -79,66 +79,66 @@ enum btr_latch_mode { /** If this is ORed to btr_latch_mode, it means that the search tuple will be inserted to the index, at the searched position. When the record is not in the buffer pool, try to use the insert buffer. */ -#define BTR_INSERT 512 +#define BTR_INSERT 512U /** This flag ORed to btr_latch_mode says that we do the search in query optimization */ -#define BTR_ESTIMATE 1024 +#define BTR_ESTIMATE 1024U /** This flag ORed to BTR_INSERT says that we can ignore possible UNIQUE definition on secondary indexes when we decide if we can use the insert buffer to speed up inserts */ -#define BTR_IGNORE_SEC_UNIQUE 2048 +#define BTR_IGNORE_SEC_UNIQUE 2048U /** Try to delete mark the record at the searched position using the insert/delete buffer when the record is not in the buffer pool. */ -#define BTR_DELETE_MARK 4096 +#define BTR_DELETE_MARK 4096U /** Try to purge the record at the searched position using the insert/delete buffer when the record is not in the buffer pool. */ -#define BTR_DELETE 8192 +#define BTR_DELETE 8192U /** In the case of BTR_SEARCH_LEAF or BTR_MODIFY_LEAF, the caller is already holding an S latch on the index tree */ -#define BTR_ALREADY_S_LATCHED 16384 +#define BTR_ALREADY_S_LATCHED 16384U /** In the case of BTR_MODIFY_TREE, the caller specifies the intention to insert record only. It is used to optimize block->lock range.*/ -#define BTR_LATCH_FOR_INSERT 32768 +#define BTR_LATCH_FOR_INSERT 32768U /** In the case of BTR_MODIFY_TREE, the caller specifies the intention to delete record only. It is used to optimize block->lock range.*/ -#define BTR_LATCH_FOR_DELETE 65536 +#define BTR_LATCH_FOR_DELETE 65536U /** This flag is for undo insert of rtree. For rtree, we need this flag to find proper rec to undo insert.*/ -#define BTR_RTREE_UNDO_INS 131072 +#define BTR_RTREE_UNDO_INS 131072U /** In the case of BTR_MODIFY_LEAF, the caller intends to allocate or free the pages of externally stored fields. */ -#define BTR_MODIFY_EXTERNAL 262144 +#define BTR_MODIFY_EXTERNAL 262144U /** Try to delete mark the record at the searched position when the record is in spatial index */ -#define BTR_RTREE_DELETE_MARK 524288 - -#define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \ - ((latch_mode) & ~(BTR_INSERT \ - | BTR_DELETE_MARK \ - | BTR_RTREE_UNDO_INS \ - | BTR_RTREE_DELETE_MARK \ - | BTR_DELETE \ - | BTR_ESTIMATE \ - | BTR_IGNORE_SEC_UNIQUE \ - | BTR_ALREADY_S_LATCHED \ - | BTR_LATCH_FOR_INSERT \ - | BTR_LATCH_FOR_DELETE \ - | BTR_MODIFY_EXTERNAL)) - -#define BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode) \ - ((latch_mode) & ~(BTR_LATCH_FOR_INSERT \ - | BTR_LATCH_FOR_DELETE \ - | BTR_MODIFY_EXTERNAL)) +#define BTR_RTREE_DELETE_MARK 524288U + +#define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \ + ((latch_mode) & btr_latch_mode(~(BTR_INSERT \ + | BTR_DELETE_MARK \ + | BTR_RTREE_UNDO_INS \ + | BTR_RTREE_DELETE_MARK \ + | BTR_DELETE \ + | BTR_ESTIMATE \ + | BTR_IGNORE_SEC_UNIQUE \ + | BTR_ALREADY_S_LATCHED \ + | BTR_LATCH_FOR_INSERT \ + | BTR_LATCH_FOR_DELETE \ + | BTR_MODIFY_EXTERNAL))) + +#define BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode) \ + ((latch_mode) & btr_latch_mode(~(BTR_LATCH_FOR_INSERT \ + | BTR_LATCH_FOR_DELETE \ + | BTR_MODIFY_EXTERNAL))) /**************************************************************//** Report that an index page is corrupted. */ @@ -206,7 +206,7 @@ btr_block_get_func( const page_size_t& page_size, ulint mode, const char* file, - ulint line, + unsigned line, dict_index_t* index, mtr_t* mtr); @@ -507,7 +507,7 @@ btr_insert_on_non_leaf_level_func( ulint level, /*!< in: level, must be > 0 */ dtuple_t* tuple, /*!< in: the record to be inserted */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define btr_insert_on_non_leaf_level(f,i,l,t,m) \ btr_insert_on_non_leaf_level_func(f,i,l,t,__FILE__,__LINE__,m) diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 810ac8f8b67..308fcfe9b03 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2017, 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 @@ -51,7 +51,7 @@ btr_block_get_func( const page_size_t& page_size, ulint mode, const char* file, - ulint line, + unsigned line, dict_index_t* index, mtr_t* mtr) { diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index a1e37ec46d0..19109e30b13 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -64,9 +65,6 @@ struct btr_latch_leaves_t { #include "row0types.h" #include "ha0ha.h" -#define BTR_CUR_ADAPT -#define BTR_CUR_HASH_ADAPT - #ifdef UNIV_DEBUG /*********************************************************//** Returns the page cursor component of a tree cursor. @@ -145,7 +143,7 @@ btr_cur_optimistic_latch_leaves( ulint* latch_mode, btr_cur_t* cursor, const char* file, - ulint line, + unsigned line, mtr_t* mtr); /********************************************************************//** @@ -188,7 +186,7 @@ btr_cur_search_to_nth_level( currently has on search system: RW_S_LATCH, or 0 */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr, /*!< in/out: mini-transaction */ ib_uint64_t autoinc = 0); /*!< in: PAGE_ROOT_AUTO_INC to be written @@ -208,7 +206,7 @@ btr_cur_open_at_index_side_func( ulint level, /*!< in: level to search for (0=leaf) */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull)); @@ -226,7 +224,7 @@ btr_cur_open_at_rnd_pos_func( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* cursor, /*!< in/out: B-tree cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define btr_cur_open_at_rnd_pos(i,l,c,m) \ btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m) @@ -970,27 +968,29 @@ stored part. */ significant bit of the byte at smallest address) is set to 1 if this field does not 'own' the externally stored field; only the owner field is allowed to free the field in purge! */ -#define BTR_EXTERN_OWNER_FLAG 128 +#define BTR_EXTERN_OWNER_FLAG 128U /** If the second most significant bit of BTR_EXTERN_LEN (i.e., the second most significant bit of the byte at smallest address) is 1 then it means that the externally stored field was inherited from an earlier version of the row. In rollback we are not allowed to free an inherited external field. */ -#define BTR_EXTERN_INHERITED_FLAG 64 +#define BTR_EXTERN_INHERITED_FLAG 64U /** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */ extern ulint btr_cur_n_non_sea; -/** Number of successful adaptive hash index lookups in -btr_cur_search_to_nth_level(). */ -extern ulint btr_cur_n_sea; /** Old value of btr_cur_n_non_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ extern ulint btr_cur_n_non_sea_old; +#ifdef BTR_CUR_HASH_ADAPT +/** Number of successful adaptive hash index lookups in +btr_cur_search_to_nth_level(). */ +extern ulint btr_cur_n_sea; /** Old value of btr_cur_n_sea. Copied by srv_refresh_innodb_monitor_stats(). Referenced by srv_printf_innodb_monitor(). */ extern ulint btr_cur_n_sea_old; +#endif /* BTR_CUR_HASH_ADAPT */ #ifdef UNIV_DEBUG /* Flag to limit optimistic insert records */ diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h index 947316f0e4d..28636715c2b 100644 --- a/storage/innobase/include/btr0pcur.h +++ b/storage/innobase/include/btr0pcur.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -113,7 +114,7 @@ btr_pcur_open_low( ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written (0 if none) */ mtr_t* mtr); /*!< in: mtr */ @@ -145,7 +146,7 @@ btr_pcur_open_with_no_init_func( currently has on search system: RW_S_LATCH, or 0 */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \ btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m) @@ -202,7 +203,7 @@ btr_pcur_open_on_user_rec_func( btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define btr_pcur_open_on_user_rec(i,t,md,l,c,m) \ btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m) @@ -218,7 +219,7 @@ btr_pcur_open_at_rnd_pos_func( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define btr_pcur_open_at_rnd_pos(i,l,c,m) \ btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m) @@ -272,7 +273,7 @@ btr_pcur_restore_position_func( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: detached persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define btr_pcur_restore_position(l,cur,mtr) \ btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr) diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic index 60790bc1316..425593631d3 100644 --- a/storage/innobase/include/btr0pcur.ic +++ b/storage/innobase/include/btr0pcur.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2017, 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 @@ -433,7 +433,7 @@ btr_pcur_open_low( ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written (0 if none) */ mtr_t* mtr) /*!< in: mtr */ @@ -499,7 +499,7 @@ btr_pcur_open_with_no_init_func( currently has on search system: RW_S_LATCH, or 0 */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { btr_cur_t* btr_cursor; @@ -574,7 +574,7 @@ btr_pcur_open_at_rnd_pos_func( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { /* Initialize the cursor */ diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 12659037904..8ff411cffd0 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -32,6 +32,7 @@ Created 2/17/1996 Heikki Tuuri #include "dict0dict.h" #include "btr0types.h" #include "mtr0mtr.h" +#ifdef BTR_CUR_HASH_ADAPT #include "ha0ha.h" /** Creates and initializes the adaptive search system at a database start. @@ -57,22 +58,6 @@ btr_search_disable( void btr_search_enable(); -/********************************************************************//** -Returns search info for an index. -@return search info; search mutex reserved */ -UNIV_INLINE -btr_search_t* -btr_search_get_info( -/*================*/ - dict_index_t* index) /*!< in: index */ - MY_ATTRIBUTE((nonnull)); - -/** Creates and initializes a search info struct. -@param[in] heap heap where created. -@return own: search info struct */ -btr_search_t* -btr_search_info_create(mem_heap_t* heap); - /** Returns the value of ref_count. The value is protected by latch. @param[in] info search info @param[in] index index identifier @@ -257,16 +242,40 @@ A table is selected from an array of tables using pair of index-id, space-id. UNIV_INLINE hash_table_t* btr_get_search_table(const dict_index_t* index); +#else /* BTR_CUR_HASH_ADAPT */ +# define btr_search_sys_create(size) +# define btr_search_drop_page_hash_index(block) +# define btr_search_s_lock(index) +# define btr_search_s_unlock(index) +# define btr_search_x_lock(index) +# define btr_search_x_unlock(index) +# define btr_search_info_update(index, cursor) +# define btr_search_move_or_delete_hash_entries(new_block, block, index) +# define btr_search_update_hash_on_insert(cursor) +# define btr_search_update_hash_on_delete(cursor) +# define btr_search_sys_resize(hash_size) +#endif /* BTR_CUR_HASH_ADAPT */ + +#ifdef BTR_CUR_ADAPT +/** Create and initialize search info. +@param[in,out] heap heap where created +@return own: search info struct */ +UNIV_INLINE +btr_search_t* +btr_search_info_create(mem_heap_t* heap) + MY_ATTRIBUTE((nonnull, warn_unused_result)); + +/** @return the search info of an index */ +UNIV_INLINE +btr_search_t* +btr_search_get_info(dict_index_t* index) +{ + return(index->search_info); +} +#endif /* BTR_CUR_ADAPT */ /** The search info struct in an index */ struct btr_search_t{ - ulint ref_count; /*!< Number of blocks in this index tree - that have search index built - i.e. block->index points to this index. - Protected by search latch except - when during initialization in - btr_search_info_create(). */ - /* @{ The following fields are not protected by any latch. Unfortunately, this means that they must be aligned to the machine word, i.e., they cannot be turned into bit-fields. */ @@ -274,6 +283,7 @@ struct btr_search_t{ fetched, or NULL */ ulint withdraw_clock; /*!< the withdraw clock value of the buffer pool when root_guess was stored */ +#ifdef BTR_CUR_HASH_ADAPT ulint hash_analysis; /*!< when this exceeds BTR_SEARCH_HASH_ANALYSIS, the hash analysis starts; this is reset if no @@ -289,6 +299,13 @@ struct btr_search_t{ using the hash index; the range is 0 .. BTR_SEARCH_BUILD_LIMIT + 5 */ /* @} */ + ulint ref_count; /*!< Number of blocks in this index tree + that have search index built + i.e. block->index points to this index. + Protected by search latch except + when during initialization in + btr_search_info_create(). */ + /*---------------------- @{ */ ulint n_fields; /*!< recommended prefix length for hash search: number of full fields */ @@ -308,6 +325,7 @@ struct btr_search_t{ far */ ulint n_searches; /*!< number of searches */ #endif /* UNIV_SEARCH_PERF_STAT */ +#endif /* BTR_CUR_HASH_ADAPT */ #ifdef UNIV_DEBUG ulint magic_n; /*!< magic number @see BTR_SEARCH_MAGIC_N */ /** value of btr_search_t::magic_n, used in assertions */ @@ -315,6 +333,7 @@ struct btr_search_t{ #endif /* UNIV_DEBUG */ }; +#ifdef BTR_CUR_HASH_ADAPT /** The hash index system */ struct btr_search_sys_t{ hash_table_t** hash_tables; /*!< the adaptive hash tables, @@ -352,6 +371,7 @@ the hash index */ over calls from MySQL. If we notice someone waiting for the latch, we again set this much timeout. This is to reduce contention. */ #define BTR_SEA_TIMEOUT 10000 +#endif /* BTR_CUR_HASH_ADAPT */ #ifndef UNIV_NONINL #include "btr0sea.ic" diff --git a/storage/innobase/include/btr0sea.ic b/storage/innobase/include/btr0sea.ic index 5f7c39ba500..b5a7536a2b4 100644 --- a/storage/innobase/include/btr0sea.ic +++ b/storage/innobase/include/btr0sea.ic @@ -27,6 +27,24 @@ Created 2/17/1996 Heikki Tuuri #include "btr0cur.h" #include "buf0buf.h" +/** Create and initialize search info. +@param[in,out] heap heap where created +@return own: search info struct */ +UNIV_INLINE +btr_search_t* +btr_search_info_create(mem_heap_t* heap) +{ + btr_search_t* info = static_cast<btr_search_t*>( + mem_heap_zalloc(heap, sizeof(btr_search_t))); + ut_d(info->magic_n = BTR_SEARCH_MAGIC_N); +#ifdef BTR_CUR_HASH_ADAPT + info->n_fields = 1; + info->left_side = TRUE; +#endif /* BTR_CUR_HASH_ADAPT */ + return(info); +} + +#ifdef BTR_CUR_HASH_ADAPT /*********************************************************************//** Updates the search info. */ void @@ -35,18 +53,6 @@ btr_search_info_update_slow( btr_search_t* info, /*!< in/out: search info */ btr_cur_t* cursor);/*!< in: cursor which was just positioned */ -/********************************************************************//** -Returns search info for an index. -@return search info; search mutex reserved */ -UNIV_INLINE -btr_search_t* -btr_search_get_info( -/*================*/ - dict_index_t* index) /*!< in: index */ -{ - return(index->search_info); -} - /*********************************************************************//** Updates the search info. */ UNIV_INLINE @@ -221,3 +227,4 @@ btr_get_search_table(const dict_index_t* index) return(btr_search_sys->hash_tables[ifold % btr_ahi_parts]); } +#endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/include/btr0types.h b/storage/innobase/include/btr0types.h index 19c21982011..77d1b286fbb 100644 --- a/storage/innobase/include/btr0types.h +++ b/storage/innobase/include/btr0types.h @@ -40,12 +40,14 @@ struct btr_cur_t; /** B-tree search information for the adaptive hash index */ struct btr_search_t; +#ifdef BTR_CUR_HASH_ADAPT /** Is search system enabled. Search system is protected by array of latches. */ extern char btr_search_enabled; /** Number of adaptive hash index partition. */ extern ulong btr_ahi_parts; +#endif /* BTR_CUR_HASH_ADAPT */ /** The size of a reference to data stored on a different page. The reference is stored at the end of the prefix of the field diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index ce2a8e385fc..ea0dd48cdbd 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2017, 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 @@ -395,11 +395,11 @@ extern "C" os_thread_ret_t DECLARE_THREAD(buf_resize_thread)(void*); -/********************************************************************//** -Clears the adaptive hash index on all pages in the buffer pool. */ +#ifdef BTR_CUR_HASH_ADAPT +/** Clear the adaptive hash index on all pages in the buffer pool. */ void -buf_pool_clear_hash_index(void); -/*===========================*/ +buf_pool_clear_hash_index(); +#endif /* BTR_CUR_HASH_ADAPT */ /*********************************************************************//** Gets the current size of buffer buf_pool in bytes. @@ -493,7 +493,7 @@ buf_page_optimistic_get( buf_block_t* block, /*!< in: guessed block */ ib_uint64_t modify_clock,/*!< in: modify clock value */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mini-transaction */ /********************************************************************//** This is used to get access to a known database page, when no waiting can be @@ -506,7 +506,7 @@ buf_page_get_known_nowait( buf_block_t* block, /*!< in: the known page */ ulint mode, /*!< in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mini-transaction */ /** Given a tablespace id and page number tries to get that page. If the @@ -521,7 +521,7 @@ buf_block_t* buf_page_try_get_func( const page_id_t& page_id, const char* file, - ulint line, + unsigned line, mtr_t* mtr); /** Tries to get a page. @@ -567,7 +567,7 @@ buf_page_get_gen( buf_block_t* guess, ulint mode, const char* file, - ulint line, + unsigned line, mtr_t* mtr, dberr_t* err); @@ -647,7 +647,7 @@ buf_page_reset_file_page_was_freed( Reads the freed_page_clock of a buffer block. @return freed_page_clock */ UNIV_INLINE -ulint +unsigned buf_page_get_freed_page_clock( /*==========================*/ const buf_page_t* bpage) /*!< in: block */ @@ -656,7 +656,7 @@ buf_page_get_freed_page_clock( Reads the freed_page_clock of a buffer block. @return freed_page_clock */ UNIV_INLINE -ulint +unsigned buf_block_get_freed_page_clock( /*===========================*/ const buf_block_t* block) /*!< in: block */ @@ -720,7 +720,7 @@ buf_block_buf_fix_inc_func( /*=======================*/ # ifdef UNIV_DEBUG const char* file, /*!< in: file name */ - ulint line, /*!< in: line */ + unsigned line, /*!< in: line */ # endif /* UNIV_DEBUG */ buf_block_t* block) /*!< in/out: block to bufferfix */ MY_ATTRIBUTE((nonnull)); @@ -820,7 +820,7 @@ Gets the hash value of a block. This can be used in searches in the lock hash table. @return lock hash value */ UNIV_INLINE -ulint +unsigned buf_block_get_lock_hash_val( /*========================*/ const buf_block_t* block) /*!< in: block */ @@ -1160,7 +1160,7 @@ void buf_page_set_old( /*=============*/ buf_page_t* bpage, /*!< in/out: control block */ - ibool old); /*!< in: old */ + bool old); /*!< in: old */ /*********************************************************************//** Determine the time of first access of a block in the buffer pool. @return ut_time_ms() at the time of first access, 0 if not accessed */ @@ -1210,12 +1210,14 @@ if applicable. */ #define buf_block_get_page_zip(block) \ ((block)->page.zip.data ? &(block)->page.zip : NULL) +#ifdef BTR_CUR_HASH_ADAPT /** Get a buffer block from an adaptive hash index pointer. This function does not return if the block is not identified. @param[in] ptr pointer to within a page frame @return pointer to block, never NULL */ buf_block_t* buf_block_from_ahi(const byte* ptr); +#endif /* BTR_CUR_HASH_ADAPT */ /********************************************************************//** Find out if a pointer belongs to a buf_block_t. It can be a pointer to @@ -1272,7 +1274,7 @@ buf_page_io_complete( Calculates the index of a buffer pool to the buf_pool[] array. @return the position of the buffer pool in buf_pool[] */ UNIV_INLINE -ulint +unsigned buf_pool_index( /*===========*/ const buf_pool_t* buf_pool) /*!< in: buffer pool */ @@ -1799,6 +1801,7 @@ struct buf_block_t{ bufferfixed, or (2) the thread has an x-latch on the block */ /* @} */ +#ifdef BTR_CUR_HASH_ADAPT /** @name Hash search fields (unprotected) NOTE that these fields are NOT protected by any semaphore! */ /* @{ */ @@ -1830,11 +1833,11 @@ struct buf_block_t{ /* @{ */ -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ulint n_pointers; /*!< used in debugging: the number of pointers in the adaptive hash index pointing to this frame */ -#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ unsigned curr_n_fields:10;/*!< prefix length for hash indexing: number of full fields */ unsigned curr_n_bytes:15;/*!< number of bytes in hash @@ -1849,6 +1852,7 @@ struct buf_block_t{ complete, though: there may have been hash collisions, record deletions, etc. */ +#endif /* BTR_CUR_HASH_ADAPT */ bool skip_flush_check; /*!< Skip check in buf_dblwr_check_block during bulk load, protected by lock.*/ @@ -2200,7 +2204,7 @@ struct buf_pool_t{ recovery and is set to NULL once the recovery is over. Protected by flush_list_mutex */ - ulint freed_page_clock;/*!< a sequence number used + unsigned freed_page_clock;/*!< a sequence number used to count the number of buffer blocks removed from the end of the LRU list; NOTE that this diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index 5e75c446bbd..429c7fd3ba6 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -2,7 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2014, 2016, MariaDB Corporation. +Copyright (c) 2014, 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -71,12 +71,12 @@ buf_pool_get_curr_size(void) Calculates the index of a buffer pool to the buf_pool[] array. @return the position of the buffer pool in buf_pool[] */ UNIV_INLINE -ulint +unsigned buf_pool_index( /*===========*/ const buf_pool_t* buf_pool) /*!< in: buffer pool */ { - ulint i = buf_pool - buf_pool_ptr; + unsigned i = unsigned(buf_pool - buf_pool_ptr); ut_ad(i < MAX_BUFFER_POOLS); ut_ad(i < srv_buf_pool_instances); return(i); @@ -91,10 +91,8 @@ buf_pool_from_bpage( /*================*/ const buf_page_t* bpage) /*!< in: buffer pool page */ { - ulint i; - i = bpage->buf_pool_index; - ut_ad(i < srv_buf_pool_instances); - return(&buf_pool_ptr[i]); + ut_ad(bpage->buf_pool_index < srv_buf_pool_instances); + return(&buf_pool_ptr[bpage->buf_pool_index]); } /******************************************************************//** @@ -124,7 +122,7 @@ buf_pool_get_n_pages(void) Reads the freed_page_clock of a buffer block. @return freed_page_clock */ UNIV_INLINE -ulint +unsigned buf_page_get_freed_page_clock( /*==========================*/ const buf_page_t* bpage) /*!< in: block */ @@ -137,7 +135,7 @@ buf_page_get_freed_page_clock( Reads the freed_page_clock of a buffer block. @return freed_page_clock */ UNIV_INLINE -ulint +unsigned buf_block_get_freed_page_clock( /*===========================*/ const buf_block_t* block) /*!< in: block */ @@ -162,7 +160,7 @@ buf_page_peek_if_young( /* FIXME: bpage->freed_page_clock is 31 bits */ return((buf_pool->freed_page_clock & ((1UL << 31) - 1)) - < ((ulint) bpage->freed_page_clock + < (bpage->freed_page_clock + (buf_pool->curr_size * (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio) / (BUF_LRU_OLD_RATIO_DIV * 4)))); @@ -629,7 +627,7 @@ void buf_page_set_old( /*=============*/ buf_page_t* bpage, /*!< in/out: control block */ - ibool old) /*!< in: old */ + bool old) /*!< in: old */ { #ifdef UNIV_DEBUG buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); @@ -792,7 +790,7 @@ Gets the hash value of the page the pointer is pointing to. This can be used in searches in the lock hash table. @return lock hash value */ UNIV_INLINE -ulint +unsigned buf_block_get_lock_hash_val( /*========================*/ const buf_block_t* block) /*!< in: block */ @@ -978,7 +976,7 @@ buf_block_buf_fix_inc_func( /*=======================*/ #ifdef UNIV_DEBUG const char* file, /*!< in: file name */ - ulint line, /*!< in: line */ + unsigned line, /*!< in: line */ #endif /* UNIV_DEBUG */ buf_block_t* block) /*!< in/out: block to bufferfix */ { diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h index 273f9666419..fd124e8f94e 100644 --- a/storage/innobase/include/buf0flu.h +++ b/storage/innobase/include/buf0flu.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2016, MariaDB Corporation +Copyright (c) 2014, 2017, 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 @@ -376,7 +376,7 @@ public: /** Check pages have been flushed and removed from the flush list in a buffer pool instance. - @pram[in] instance_no buffer pool instance no + @param[in] instance_no buffer pool instance no @return true if the pages were removed from the flush list */ bool is_complete(ulint instance_no) { diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic index 2fe5190591b..81788885aa5 100644 --- a/storage/innobase/include/data0data.ic +++ b/storage/innobase/include/data0data.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -221,7 +222,7 @@ dfield_write_mbr( #endif /* UNIV_VALGRIND_DEBUG */ field->ext = 0; - for (int i = 0; i < SPDIMS * 2; i++) { + for (unsigned i = 0; i < SPDIMS * 2; i++) { mach_double_write(static_cast<byte*>(field->data) + i * sizeof(double), mbr[i]); } diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h index d38aa7c1533..958f5a4d0de 100644 --- a/storage/innobase/include/data0type.h +++ b/storage/innobase/include/data0type.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -147,7 +148,7 @@ columns, and for them the precise type is usually not used at all. for InnoDB's own system tables */ #define DATA_ERROR 111 /* another relic from pre-MySQL time */ -#define DATA_MYSQL_TYPE_MASK 255 /* AND with this mask to extract the MySQL +#define DATA_MYSQL_TYPE_MASK 255U/* AND with this mask to extract the MySQL type from the precise type */ #define DATA_MYSQL_TRUE_VARCHAR 15 /* MySQL type code for the >= 5.0.3 format true VARCHAR */ @@ -168,14 +169,14 @@ be less than 256 */ #define DATA_FTS_DOC_ID 3 /* Used as FTS DOC ID column */ -#define DATA_SYS_PRTYPE_MASK 0xF /* mask to extract the above from prtype */ +#define DATA_SYS_PRTYPE_MASK 0xFU /* mask to extract the above from prtype */ /* Flags ORed to the precise data type */ -#define DATA_NOT_NULL 256 /* this is ORed to the precise type when +#define DATA_NOT_NULL 256U /* this is ORed to the precise type when the column is declared as NOT NULL */ -#define DATA_UNSIGNED 512 /* this id ORed to the precise type when +#define DATA_UNSIGNED 512U /* this id ORed to the precise type when we have an unsigned integer type */ -#define DATA_BINARY_TYPE 1024 /* if the data type is a binary character +#define DATA_BINARY_TYPE 1024U /* if the data type is a binary character string, this is ORed to the precise type: this only holds for tables created with >= MySQL-4.0.14 */ @@ -183,14 +184,14 @@ be less than 256 */ In earlier versions this was set for some BLOB columns. */ -#define DATA_GIS_MBR 2048 /* Used as GIS MBR column */ +#define DATA_GIS_MBR 2048U /* Used as GIS MBR column */ #define DATA_MBR_LEN SPDIMS * 2 * sizeof(double) /* GIS MBR length*/ -#define DATA_LONG_TRUE_VARCHAR 4096 /* this is ORed to the precise data +#define DATA_LONG_TRUE_VARCHAR 4096U /* this is ORed to the precise data type when the column is true VARCHAR where MySQL uses 2 bytes to store the data len; for shorter VARCHARs MySQL uses only 1 byte */ -#define DATA_VIRTUAL 8192 /* Virtual column */ +#define DATA_VIRTUAL 8192U /* Virtual column */ /** Get the number of system columns in a table. */ #define dict_table_get_n_sys_cols(table) DATA_N_SYS_COLS @@ -221,14 +222,12 @@ length from corresponding column or index definition, instead of this MACRO /* 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)) + unsigned((mbmaxlen) * DATA_MBMAX + (mbminlen)) +/* Get mbminlen from mbminmaxlen. */ +#define DATA_MBMINLEN(mbminmaxlen) \ + unsigned(UNIV_EXPECT((mbminmaxlen) % DATA_MBMAX, 1)) /* Get mbmaxlen from mbminmaxlen. */ -#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX)) +#define DATA_MBMAXLEN(mbminmaxlen) unsigned((mbminmaxlen) / DATA_MBMAX) /* For checking if a geom_type is POINT */ #define DATA_POINT_MTYPE(mtype) ((mtype) == DATA_POINT \ @@ -369,16 +368,21 @@ ulint dtype_get_charset_coll( /*===================*/ ulint prtype);/*!< in: precise data type */ -/*********************************************************************//** -Forms a precise type from the < 4.1.2 format precise type plus the +/** Form a precise type from the < 4.1.2 format precise type plus the charset-collation code. +@param[in] old_prtype MySQL type code and the flags + DATA_BINARY_TYPE etc. +@param[in] charset_coll character-set collation code @return precise type, including the charset-collation code */ -ulint -dtype_form_prtype( -/*==============*/ - ulint old_prtype, /*!< in: the MySQL type code and the flags - DATA_BINARY_TYPE etc. */ - ulint charset_coll); /*!< in: MySQL charset-collation code */ +UNIV_INLINE +uint32_t +dtype_form_prtype(ulint old_prtype, ulint charset_coll) +{ + ut_ad(old_prtype < 256 * 256); + ut_ad(charset_coll <= MAX_CHAR_COLL_NUM); + return(uint32_t(old_prtype + (charset_coll << 16))); +} + /*********************************************************************//** Determines if a MySQL string type is a subset of UTF-8. This function may return false negatives, in case further character-set collation diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index 869d0ba8ed6..9ec85dfaf50 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -151,9 +152,9 @@ dtype_set( ut_ad(type); ut_ad(mtype <= DATA_MTYPE_MAX); - type->mtype = mtype; - type->prtype = prtype; - type->len = len; + type->mtype = unsigned(mtype); + type->prtype = unsigned(prtype); + type->len = unsigned(len); dtype_set_mblen(type); } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 036d905f0d8..92f00549dc9 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -399,7 +399,7 @@ void dict_table_add_to_cache( /*====================*/ dict_table_t* table, /*!< in: table */ - ibool can_be_evicted, /*!< in: TRUE if can be evicted*/ + bool can_be_evicted, /*!< in: whether can be evicted*/ mem_heap_t* heap) /*!< in: temporary heap */ MY_ATTRIBUTE((nonnull)); /**********************************************************************//** @@ -1567,11 +1567,9 @@ dict_index_calc_min_rec_len( /*========================*/ const dict_index_t* index) /*!< in: index */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/********************************************************************//** -Reserves the dictionary system mutex for MySQL. */ +/** Reserve the dictionary system mutex. */ void -dict_mutex_enter_for_mysql_func(const char * file, ulint line); -/*============================*/ +dict_mutex_enter_for_mysql_func(const char *file, unsigned line); #define dict_mutex_enter_for_mysql() \ dict_mutex_enter_for_mysql_func(__FILE__, __LINE__) diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 905a1b78782..061153589c8 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -1418,7 +1418,7 @@ dict_index_set_space( ut_ad(index); ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - index->space = space; + index->space = unsigned(space); } /*********************************************************************//** diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 4a084c347d6..ff28add8ca4 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -300,28 +300,28 @@ for unknown bits in order to protect backward incompatibility. */ #define DICT_TF2_BIT_MASK ~DICT_TF2_UNUSED_BIT_MASK /** TEMPORARY; TRUE for tables from CREATE TEMPORARY TABLE. */ -#define DICT_TF2_TEMPORARY 1 +#define DICT_TF2_TEMPORARY 1U /** The table has an internal defined DOC ID column */ -#define DICT_TF2_FTS_HAS_DOC_ID 2 +#define DICT_TF2_FTS_HAS_DOC_ID 2U /** The table has an FTS index */ -#define DICT_TF2_FTS 4 +#define DICT_TF2_FTS 4U /** Need to add Doc ID column for FTS index build. This is a transient bit for index build */ -#define DICT_TF2_FTS_ADD_DOC_ID 8 +#define DICT_TF2_FTS_ADD_DOC_ID 8U /** This bit is used during table creation to indicate that it will use its own tablespace instead of the system tablespace. */ -#define DICT_TF2_USE_FILE_PER_TABLE 16 +#define DICT_TF2_USE_FILE_PER_TABLE 16U /** Set when we discard/detach the tablespace */ -#define DICT_TF2_DISCARDED 32 +#define DICT_TF2_DISCARDED 32U /** This bit is set if all aux table names (both common tables and index tables) of a FTS table are in HEX format. */ -#define DICT_TF2_FTS_AUX_HEX_NAME 64 +#define DICT_TF2_FTS_AUX_HEX_NAME 64U /* @} */ @@ -878,6 +878,7 @@ struct dict_index_t{ representation we add more columns */ unsigned nulls_equal:1; /*!< if true, SQL NULL == SQL NULL */ +#ifdef BTR_CUR_HASH_ADAPT #ifdef MYSQL_INDEX_DISABLE_AHI unsigned disable_ahi:1; /*!< whether to disable the @@ -885,6 +886,7 @@ struct dict_index_t{ Maybe this could be disabled for temporary tables? */ #endif +#endif /* BTR_CUR_HASH_ADAPT */ unsigned n_uniq:10;/*!< number of fields from the beginning which are enough to determine an index entry uniquely */ @@ -923,8 +925,10 @@ struct dict_index_t{ column in ALTER */ UT_LIST_NODE_T(dict_index_t) indexes;/*!< list of indexes of the table */ +#ifdef BTR_CUR_ADAPT btr_search_t* search_info; /*!< info used in optimistic searches */ +#endif /* BTR_CUR_ADAPT */ row_log_t* online_log; /*!< the log of modifications during online index creation; @@ -1253,12 +1257,12 @@ struct dict_foreign_set_free { /** The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that a foreign key constraint is enforced, therefore RESTRICT just means no flag */ /* @{ */ -#define DICT_FOREIGN_ON_DELETE_CASCADE 1 /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_DELETE_SET_NULL 2 /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_UPDATE_CASCADE 4 /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8 /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16 /*!< ON DELETE NO ACTION */ -#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 /*!< ON UPDATE NO ACTION */ +#define DICT_FOREIGN_ON_DELETE_CASCADE 1U /*!< ON DELETE CASCADE */ +#define DICT_FOREIGN_ON_DELETE_SET_NULL 2U /*!< ON UPDATE SET NULL */ +#define DICT_FOREIGN_ON_UPDATE_CASCADE 4U /*!< ON DELETE CASCADE */ +#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8U /*!< ON UPDATE SET NULL */ +#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16U /*!< ON DELETE NO ACTION */ +#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32U /*!< ON UPDATE NO ACTION */ /* @} */ /** Display an identifier. @@ -1319,7 +1323,7 @@ struct dict_vcol_templ_t { /** when mysql_table was cached */ uint64_t mysql_table_query_id; - dict_vcol_templ_t() : vtempl(0), mysql_table_query_id(-1) {} + dict_vcol_templ_t() : vtempl(0), mysql_table_query_id(~0ULL) {} }; /** These are used when MySQL FRM and InnoDB data dictionary are diff --git a/storage/innobase/include/dict0mem.ic b/storage/innobase/include/dict0mem.ic index 933f233aae6..da2ac629850 100644 --- a/storage/innobase/include/dict0mem.ic +++ b/storage/innobase/include/dict0mem.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -59,7 +60,7 @@ dict_mem_fill_index_struct( /* Assign a ulint to a 4-bit-mapped field. Only the low-order 4 bits are assigned. */ - index->type = type; + index->type = unsigned(type); index->space = (unsigned int) space; index->page = FIL_NULL; index->merge_threshold = DICT_INDEX_MERGE_THRESHOLD_DEFAULT; @@ -68,11 +69,10 @@ dict_mem_fill_index_struct( /* The '1 +' above prevents allocation of an empty mem block */ index->nulls_equal = false; +#ifdef BTR_CUR_HASH_ADAPT #ifdef MYSQL_INDEX_DISABLE_AHI index->disable_ahi = false; #endif - -#ifdef UNIV_DEBUG - index->magic_n = DICT_INDEX_MAGIC_N; -#endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ + ut_d(index->magic_n = DICT_INDEX_MAGIC_N); } diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h index 8941b399f7d..cb16a4dee9c 100644 --- a/storage/innobase/include/dict0stats.h +++ b/storage/innobase/include/dict0stats.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2009, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -77,14 +78,10 @@ dict_stats_set_persistent( ibool ps_off) /*!< in: persistent stats explicitly disabled */ MY_ATTRIBUTE((nonnull)); -/*********************************************************************//** -Check whether persistent statistics is enabled for a given table. -@return TRUE if enabled, FALSE otherwise */ +/** @return whether persistent statistics is enabled for a given table */ UNIV_INLINE -ibool -dict_stats_is_persistent_enabled( -/*=============================*/ - const dict_table_t* table) /*!< in: table */ +bool +dict_stats_is_persistent_enabled(const dict_table_t* table) MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** @@ -100,14 +97,11 @@ dict_stats_auto_recalc_set( ibool auto_recalc_on, /*!< in: explicitly enabled */ ibool auto_recalc_off); /*!< in: explicitly disabled */ -/*********************************************************************//** -Check whether auto recalc is enabled for a given table. -@return TRUE if enabled, FALSE otherwise */ +/** @return whether auto recalc is enabled for a given table*/ UNIV_INLINE -ibool -dict_stats_auto_recalc_is_enabled( -/*==============================*/ - const dict_table_t* table); /*!< in: table */ +bool +dict_stats_auto_recalc_is_enabled(const dict_table_t* table) + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Initialize table's stats for the first time when opening a table. */ diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic index 61c88773912..1efe5780b58 100644 --- a/storage/innobase/include/dict0stats.ic +++ b/storage/innobase/include/dict0stats.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -60,14 +61,10 @@ dict_stats_set_persistent( table->stat_persistent = stat_persistent; } -/*********************************************************************//** -Check whether persistent statistics is enabled for a given table. -@return TRUE if enabled, FALSE otherwise */ +/** @return whether persistent statistics is enabled for a given table */ UNIV_INLINE -ibool -dict_stats_is_persistent_enabled( -/*=============================*/ - const dict_table_t* table) /*!< in: table */ +bool +dict_stats_is_persistent_enabled(const dict_table_t* table) { /* Because of the nature of this check (non-locking) it is possible that a table becomes: @@ -89,9 +86,9 @@ dict_stats_is_persistent_enabled( if (stat_persistent & DICT_STATS_PERSISTENT_ON) { ut_ad(!(stat_persistent & DICT_STATS_PERSISTENT_OFF)); - return(TRUE); + return(true); } else if (stat_persistent & DICT_STATS_PERSISTENT_OFF) { - return(FALSE); + return(false); } else { return(srv_stats_persistent); } @@ -126,23 +123,19 @@ dict_stats_auto_recalc_set( table->stats_auto_recalc = stats_auto_recalc; } -/*********************************************************************//** -Check whether auto recalc is enabled for a given table. -@return TRUE if enabled, FALSE otherwise */ +/** @return whether auto recalc is enabled for a given table*/ UNIV_INLINE -ibool -dict_stats_auto_recalc_is_enabled( -/*==============================*/ - const dict_table_t* table) /*!< in: table */ +bool +dict_stats_auto_recalc_is_enabled(const dict_table_t* table) { /* we rely on this read to be atomic */ ib_uint32_t stats_auto_recalc = table->stats_auto_recalc; if (stats_auto_recalc & DICT_STATS_AUTO_RECALC_ON) { ut_ad(!(stats_auto_recalc & DICT_STATS_AUTO_RECALC_OFF)); - return(TRUE); + return(true); } else if (stats_auto_recalc & DICT_STATS_AUTO_RECALC_OFF) { - return(FALSE); + return(false); } else { return(srv_stats_auto_recalc); } diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index b0623f82bb7..27b4cc0e694 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2017, 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 @@ -101,7 +101,7 @@ extern uint ibuf_debug; #define SPATIAL_STATUS_SHIFT 12 /** Mask to encode/decode spatial status. */ -#define SPATIAL_STATUS_MASK (3 << SPATIAL_STATUS_SHIFT) +#define SPATIAL_STATUS_MASK (3U << SPATIAL_STATUS_SHIFT) #if SPATIAL_STATUS_MASK < REC_VERSION_56_MAX_INDEX_COL_LEN # error SPATIAL_STATUS_MASK < REC_VERSION_56_MAX_INDEX_COL_LEN diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index 7185857c039..7211d295c27 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -114,7 +114,7 @@ struct fil_space_crypt_struct : st_encryption_scheme The object is expected to be placed in a buffer that has been zero-initialized. */ fil_space_crypt_struct( - ulint new_type, + uint new_type, uint new_min_key_version, uint new_key_id, ulint offset, diff --git a/storage/innobase/include/fil0crypt.ic b/storage/innobase/include/fil0crypt.ic index 65ca4def85f..fe3a21f0643 100644 --- a/storage/innobase/include/fil0crypt.ic +++ b/storage/innobase/include/fil0crypt.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2017, 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 @@ -59,7 +59,7 @@ fil_page_encryption_status( } } } else { - ulint key = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); + unsigned key = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); if (!encryption_key_version_exists(crypt_data->key_id, key)) { return 1; } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 36fb5e51f1e..587ad902c2a 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2017, 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 @@ -176,8 +176,6 @@ struct fil_space_t { /** True if page 0 of tablespace is read */ bool read_page0; - /** True if we have tested if this filespace supports atomic writes */ - bool atomic_write_tested; /** True if the device this filespace is on supports atomic writes */ bool atomic_write_supported; @@ -484,14 +482,6 @@ struct fil_system_t { startup we scan the data dictionary and set here the maximum of the space id's of the tables there */ - int64_t tablespace_version; - /*!< a counter which is incremented for - every space object memory creation; - every space mem object gets a - 'timestamp' from this; in DISCARD/ - IMPORT this is used to check if we - should ignore an insert buffer merge - request */ UT_LIST_BASE_NODE_T(fil_space_t) space_list; /*!< list of all file spaces */ UT_LIST_BASE_NODE_T(fil_space_t) named_spaces; diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index fa8d5b76960..621498b9a4c 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -579,14 +579,22 @@ fsp_get_available_space_in_free_extents( /**********************************************************************//** Frees a single page of a segment. */ void -fseg_free_page( -/*===========*/ +fseg_free_page_func( fseg_header_t* seg_header, /*!< in: segment header */ ulint space_id, /*!< in: space id */ ulint page, /*!< in: page offset */ +#ifdef BTR_CUR_HASH_ADAPT bool ahi, /*!< in: whether we may need to drop the adaptive hash index */ +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr); /*!< in/out: mini-transaction */ +#ifdef BTR_CUR_HASH_ADAPT +# define fseg_free_page(header, space_id, page, ahi, mtr) \ + fseg_free_page_func(header, space_id, page, ahi, mtr) +#else /* BTR_CUR_HASH_ADAPT */ +# define fseg_free_page(header, space_id, page, ahi, mtr) \ + fseg_free_page_func(header, space_id, page, mtr) +#endif /* BTR_CUR_HASH_ADAPT */ /**********************************************************************//** Checks if a single page of a segment is free. @return true if free */ @@ -604,29 +612,43 @@ Doing the freeing in a single mini-transaction might result in too big a mini-transaction. @return TRUE if freeing completed */ ibool -fseg_free_step( -/*===========*/ +fseg_free_step_func( fseg_header_t* header, /*!< in, own: segment header; NOTE: if the header resides on the first page of the frag list of the segment, this pointer becomes obsolete after the last freeing step */ +#ifdef BTR_CUR_HASH_ADAPT bool ahi, /*!< in: whether we may need to drop the adaptive hash index */ +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((warn_unused_result)); +#ifdef BTR_CUR_HASH_ADAPT +# define fseg_free_step(header, ahi, mtr) fseg_free_step_func(header, ahi, mtr) +#else /* BTR_CUR_HASH_ADAPT */ +# define fseg_free_step(header, ahi, mtr) fseg_free_step_func(header, mtr) +#endif /* BTR_CUR_HASH_ADAPT */ /**********************************************************************//** Frees part of a segment. Differs from fseg_free_step because this function leaves the header page unfreed. @return TRUE if freeing completed, except the header page */ ibool -fseg_free_step_not_header( -/*======================*/ +fseg_free_step_not_header_func( fseg_header_t* header, /*!< in: segment header which must reside on the first fragment page of the segment */ +#ifdef BTR_CUR_HASH_ADAPT bool ahi, /*!< in: whether we may need to drop the adaptive hash index */ +#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((warn_unused_result)); +#ifdef BTR_CUR_HASH_ADAPT +# define fseg_free_step_not_header(header, ahi, mtr) \ + fseg_free_step_not_header_func(header, ahi, mtr) +#else /* BTR_CUR_HASH_ADAPT */ +# define fseg_free_step_not_header(header, ahi, mtr) \ + fseg_free_step_not_header_func(header, mtr) +#endif /* BTR_CUR_HASH_ADAPT */ /** Checks if a page address is an extent descriptor page address. @param[in] page_id page id @@ -840,7 +862,7 @@ fsp_page_is_free_func( ulint page, /*!< in: page offset */ mtr_t* mtr, /*!< in/out: mini-transaction */ const char *file, - ulint line); + unsigned line); #define fsp_page_is_free(space,page,mtr) \ fsp_page_is_free_func(space,page,mtr, __FILE__, __LINE__) diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h index 429af4210b7..ec33f2e4d10 100644 --- a/storage/innobase/include/fsp0types.h +++ b/storage/innobase/include/fsp0types.h @@ -416,7 +416,7 @@ fsp_flags_is_valid(ulint flags) bits 10..14 would be nonzero 0bsssaa where sss is nonzero PAGE_SSIZE (3, 4, 6, or 7) and aa is ATOMIC_WRITES (not 0b11). */ - if (FSP_FLAGS_GET_RESERVED(flags) & ~1) { + if (FSP_FLAGS_GET_RESERVED(flags) & ~1U) { return(false); } diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index 436374fd6b2..950e2f2e9f5 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -151,7 +152,7 @@ rtr_cur_restore_position_func( btr_cur_t* cursor, /*!< in: detached persistent cursor */ ulint level, /*!< in: index level */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define rtr_cur_restore_position(l,cur,level,mtr) \ rtr_cur_restore_position_func(l,cur,level,__FILE__,__LINE__,mtr) @@ -351,7 +352,7 @@ rtr_page_get_father_node_ptr_func( out: cursor on node pointer record, its page x-latched */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ @@ -402,7 +403,7 @@ rtr_pcur_open_low( ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ const char* file, /*!< in: file name */ - ulint line, /*!< in: line where called */ + unsigned line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ #define rtr_pcur_open(i,t,md,l,c,m) \ diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic index a30db122273..7f64a9b13a1 100644 --- a/storage/innobase/include/gis0rtree.ic +++ b/storage/innobase/include/gis0rtree.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -64,7 +65,7 @@ rtr_page_cal_mbr( ut_ad(len == DATA_MBR_LEN); inc = 0; - for (int i = 0; i < SPDIMS; i++) { + for (unsigned i = 0; i < SPDIMS; i++) { bmin = mach_double_read(field + inc); bmax = mach_double_read(field + inc + sizeof(double)); @@ -167,7 +168,7 @@ rtr_write_mbr( { const double* my_mbr = reinterpret_cast<const double*>(mbr); - for (int i = 0; i < SPDIMS * 2; i++) { + for (unsigned i = 0; i < SPDIMS * 2; i++) { mach_double_write(data + i * sizeof(double), my_mbr[i]); } } @@ -181,7 +182,7 @@ rtr_read_mbr( const byte* data, /*!< in: data */ rtr_mbr_t* mbr) /*!< out: MBR */ { - for (int i = 0; i < SPDIMS * 2; i++) { + for (unsigned i = 0; i < SPDIMS * 2; i++) { (reinterpret_cast<double*>(mbr))[i] = mach_double_read( data + i * sizeof(double)); diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 6857670a01b..7ddcaf82aa8 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -33,6 +33,7 @@ Created 8/18/1994 Heikki Tuuri #include "buf0types.h" #include "rem0types.h" +#ifdef BTR_CUR_HASH_ADAPT /*************************************************************//** Looks for an element in a hash table. @return pointer to the data of the first hash table node in chain @@ -79,6 +80,7 @@ updates the pointer to data if found. # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \ ha_search_and_update_if_found_func(table,fold,data,new_data) #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ /*************************************************************//** Creates a hash table with at least n array cells. The actual number @@ -115,6 +117,7 @@ ha_clear( /*=====*/ hash_table_t* table); /*!< in, own: hash table */ +#ifdef BTR_CUR_HASH_ADAPT /*************************************************************//** Inserts an entry into a hash table. If an entry with the same fold number is found, its node is updated to point to the new data, and no new node @@ -212,6 +215,7 @@ struct ha_node_t { #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ const rec_t* data; /*!< pointer to the data */ }; +#endif /* BTR_CUR_HASH_ADAPT */ #ifdef UNIV_DEBUG /********************************************************************//** diff --git a/storage/innobase/include/ha0ha.ic b/storage/innobase/include/ha0ha.ic index 854ff9bc046..1513df209ad 100644 --- a/storage/innobase/include/ha0ha.ic +++ b/storage/innobase/include/ha0ha.ic @@ -23,18 +23,11 @@ The hash table with external chains Created 8/18/1994 Heikki Tuuri *************************************************************************/ +#ifdef BTR_CUR_HASH_ADAPT #include "ut0rnd.h" #include "mem0mem.h" #include "btr0types.h" -/***********************************************************//** -Deletes a hash node. */ -void -ha_delete_hash_node( -/*================*/ - hash_table_t* table, /*!< in: hash table */ - ha_node_t* del_node); /*!< in: node to be deleted */ - /******************************************************************//** Gets a hash node data. @return pointer to the data */ @@ -213,6 +206,14 @@ ha_search_with_data( return(NULL); } +/***********************************************************//** +Deletes a hash node. */ +void +ha_delete_hash_node( +/*================*/ + hash_table_t* table, /*!< in: hash table */ + ha_node_t* del_node); /*!< in: node to be deleted */ + /*********************************************************//** Looks for an element when we know the pointer to the data, and deletes it from the hash table, if found. @@ -240,3 +241,4 @@ ha_search_and_delete_if_found( return(FALSE); } +#endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index efcecf35117..2bb2c0fe773 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 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 @@ -318,16 +319,6 @@ innobase_get_at_most_n_mbchars( ulint data_len, /*!< in: length of the string in bytes */ const char* str); /*!< in: character string */ -/******************************************************************//** -Returns true if the thread supports XA, -global value of innodb_supports_xa if thd is NULL. -@return true if thd supports XA */ -ibool -thd_supports_xa( -/*============*/ - THD* thd); /*!< in: thread handle, or NULL to query - the global innodb_supports_xa */ - /** Get status of innodb_tmpdir. @param[in] thd thread handle, or NULL to query the global innodb_tmpdir. diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index 2922d424d37..738fa813ddd 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -536,11 +536,13 @@ struct hash_cell_t{ /* The hash table structure */ struct hash_table_t { enum hash_table_sync_t type; /*<! type of hash_table. */ -#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ibool adaptive;/* TRUE if this is the hash table of the adaptive hash index */ -#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ ulint n_cells;/* number of cells in the hash table */ hash_cell_t* array; /*!< pointer to cell array */ diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h index 9f4ad8424f3..76f02cc1521 100644 --- a/storage/innobase/include/ib0mutex.h +++ b/storage/innobase/include/ib0mutex.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 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 @@ -74,7 +75,7 @@ struct OSTrackMutex { void destroy() UNIV_NOTHROW { ut_ad(!m_locked); - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); m_mutex.destroy(); @@ -86,7 +87,7 @@ struct OSTrackMutex { { ut_ad(m_locked); ut_d(m_locked = false); - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); m_mutex.exit(); } @@ -103,7 +104,7 @@ struct OSTrackMutex { uint32_t line) UNIV_NOTHROW { - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); m_mutex.enter(); @@ -114,7 +115,7 @@ struct OSTrackMutex { /** @return true if locking succeeded */ bool try_lock() UNIV_NOTHROW { - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); bool locked = m_mutex.try_lock(); diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index e646f678964..ee8272d724c 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. +Copyright (c) 2016, 2017, 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 @@ -274,7 +274,7 @@ ibuf_page_low( ibool x_latch, #endif /* UNIV_DEBUG */ const char* file, - ulint line, + unsigned line, mtr_t* mtr) MY_ATTRIBUTE((warn_unused_result)); diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index d96ba0d9c7d..b211b24d7ff 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -612,7 +612,7 @@ Calculates the hash value of a page file address: used in inserting or searching for a lock in the hash table. @return hashed value */ UNIV_INLINE -ulint +unsigned lock_rec_hash( /*==========*/ ulint space, /*!< in: space */ @@ -960,15 +960,15 @@ lock_trx_alloc_locks(trx_t* trx); type_mode field in a lock */ /** Lock types */ /* @{ */ -#define LOCK_TABLE 16 /*!< table lock */ -#define LOCK_REC 32 /*!< record lock */ +#define LOCK_TABLE 16U /*!< table lock */ +#define LOCK_REC 32U /*!< record lock */ #define LOCK_TYPE_MASK 0xF0UL /*!< mask used to extract lock type from the type_mode field in a lock */ #if LOCK_MODE_MASK & LOCK_TYPE_MASK # error "LOCK_MODE_MASK & LOCK_TYPE_MASK" #endif -#define LOCK_WAIT 256 /*!< Waiting lock flag; when set, it +#define LOCK_WAIT 256U /*!< Waiting lock flag; when set, it means that the lock has not yet been granted, it is just waiting for its turn in the wait queue */ @@ -976,14 +976,14 @@ lock_trx_alloc_locks(trx_t* trx); #define LOCK_ORDINARY 0 /*!< this flag denotes an ordinary next-key lock in contrast to LOCK_GAP or LOCK_REC_NOT_GAP */ -#define LOCK_GAP 512 /*!< when this bit is set, it means that the +#define LOCK_GAP 512U /*!< when this bit is set, it means that the lock holds only on the gap before the record; for instance, an x-lock on the gap does not give permission to modify the record on which the bit is set; locks of this type are created when records are removed from the index chain of records */ -#define LOCK_REC_NOT_GAP 1024 /*!< this bit means that the lock is only on +#define LOCK_REC_NOT_GAP 1024U /*!< this bit means that the lock is only on the index record and does NOT block inserts to the gap before the index record; this is used in the case when we retrieve a record @@ -991,7 +991,7 @@ lock_trx_alloc_locks(trx_t* trx); locking plain SELECTs (not part of UPDATE or DELETE) when the user has set the READ COMMITTED isolation level */ -#define LOCK_INSERT_INTENTION 2048 /*!< this bit is set when we place a waiting +#define LOCK_INSERT_INTENTION 2048U/*!< this bit is set when we place a waiting gap type record lock request in order to let an insert of an index record to wait until there are no conflicting locks by other @@ -999,8 +999,8 @@ lock_trx_alloc_locks(trx_t* trx); remains set when the waiting lock is granted, or if the lock is inherited to a neighboring record */ -#define LOCK_PREDICATE 8192 /*!< Predicate lock */ -#define LOCK_PRDT_PAGE 16384 /*!< Page lock */ +#define LOCK_PREDICATE 8192U /*!< Predicate lock */ +#define LOCK_PRDT_PAGE 16384U /*!< Page lock */ #if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_PREDICATE|LOCK_PRDT_PAGE)&LOCK_MODE_MASK diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.ic index ba2311c02ea..6c28300467d 100644 --- a/storage/innobase/include/lock0lock.ic +++ b/storage/innobase/include/lock0lock.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -56,14 +57,14 @@ Calculates the hash value of a page file address: used in inserting or searching for a lock in the hash table. @return hashed value */ UNIV_INLINE -ulint +unsigned lock_rec_hash( /*==========*/ ulint space, /*!< in: space */ ulint page_no)/*!< in: page number */ { - return(hash_calc_hash(lock_rec_fold(space, page_no), - lock_sys->rec_hash)); + return(unsigned(hash_calc_hash(lock_rec_fold(space, page_no), + lock_sys->rec_hash))); } /*********************************************************************//** diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 956cfffbad8..de72e5291ef 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -252,10 +252,10 @@ log_group_header_read( const log_group_t* group, ulint header); /** Write checkpoint info to the log header and invoke log_mutex_exit(). -@param[in] sync whether to wait for the write to complete */ +@param[in] sync whether to wait for the write to complete +@param[in] end_lsn start LSN of the MLOG_CHECKPOINT mini-transaction */ void -log_write_checkpoint_info( - bool sync); +log_write_checkpoint_info(bool sync, lsn_t end_lsn); /** Set extra data to be written to the redo log during checkpoint. @param[in] buf data to be appended on checkpoint, or NULL @@ -487,10 +487,14 @@ extern my_bool innodb_log_checksums; .._HDR_NO */ #define LOG_BLOCK_TRL_SIZE 4 /* trailer size in bytes */ -/* Offsets inside the checkpoint pages (redo log format version 1) */ +/** Offsets inside the checkpoint pages (redo log format version 1) @{ */ +/** Checkpoint number */ #define LOG_CHECKPOINT_NO 0 +/** Log sequence number up to which all changes have been flushed */ #define LOG_CHECKPOINT_LSN 8 +/** Byte offset of the log record corresponding to LOG_CHECKPOINT_LSN */ #define LOG_CHECKPOINT_OFFSET 16 +/** log_sys_t::buf_size at the time of the checkpoint (not used) */ #define LOG_CHECKPOINT_LOG_BUF_SIZE 24 /** MariaDB 10.2.5 encrypted redo log encryption key version (32 bits)*/ #define LOG_CHECKPOINT_CRYPT_KEY 32 @@ -498,6 +502,11 @@ extern my_bool innodb_log_checksums; #define LOG_CHECKPOINT_CRYPT_NONCE 36 /** MariaDB 10.2.5 encrypted redo log random message (MY_AES_BLOCK_SIZE) */ #define LOG_CHECKPOINT_CRYPT_MESSAGE 40 +/** start LSN of the MLOG_CHECKPOINT mini-transaction corresponding +to this checkpoint, or 0 if the information has not been written */ +#define LOG_CHECKPOINT_END_LSN OS_FILE_LOG_BLOCK_SIZE - 16 + +/* @} */ /** Offsets of a log file header */ /* @{ */ diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 24a83ec2ab1..74ea6c95036 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -105,20 +105,12 @@ Reset the state of the recovery system variables. */ void recv_sys_var_init(void); /*===================*/ -/*******************************************************************//** -Empties the hash table of stored log records, applying them to appropriate -pages. */ -dberr_t -recv_apply_hashed_log_recs( -/*=======================*/ - ibool allow_ibuf) /*!< in: if TRUE, also ibuf operations are - allowed during the application; if FALSE, - no ibuf operations are allowed, and after - the application all file pages are flushed to - disk and invalidated in buffer pool: this - alternative means that no new log records - can be generated during the application */ - __attribute__((warn_unused_result)); + +/** Apply the hash table of stored log records to persistent data pages. +@param[in] last_batch whether the change buffer merge will be + performed as part of the operation */ +void +recv_apply_hashed_log_recs(bool last_batch); /** Block of log record data */ struct recv_data_t{ @@ -244,6 +236,8 @@ struct recv_sys_t{ lsn_t mlog_checkpoint_lsn; /*!< the LSN of a MLOG_CHECKPOINT record, or 0 if none was parsed */ + /** the time when progress was last reported */ + ib_time_t progress_time; mem_heap_t* heap; /*!< memory heap of log records and file addresses*/ hash_table_t* addr_hash;/*!< hash table of file addresses of pages */ @@ -251,6 +245,20 @@ struct recv_sys_t{ addresses in the hash table */ recv_dblwr_t dblwr; + + /** Determine whether redo log recovery progress should be reported. + @param[in] time the current time + @return whether progress should be reported + (the last report was at least 15 seconds ago) */ + bool report(ib_time_t time) + { + if (time - progress_time < 15) { + return false; + } + + progress_time = time; + return true; + } }; /** The recovery system */ diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h index 3d6bccec718..d3e3a53c655 100644 --- a/storage/innobase/include/mach0data.h +++ b/storage/innobase/include/mach0data.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -45,14 +46,13 @@ mach_write_to_1( /*============*/ byte* b, /*!< in: pointer to byte where to store */ ulint n); /*!< in: ulint integer to be stored, >= 0, < 256 */ -/********************************************************//** -The following function is used to fetch data from one byte. +/** The following function is used to fetch data from one byte. +@param[in] b pointer to a byte to read @return ulint integer, >= 0, < 256 */ UNIV_INLINE -ulint +uint8_t mach_read_from_1( -/*=============*/ - const byte* b) /*!< in: pointer to byte */ + const byte* b) MY_ATTRIBUTE((warn_unused_result)); /*******************************************************//** The following function is used to store data in two consecutive @@ -63,17 +63,15 @@ mach_write_to_2( /*============*/ byte* b, /*!< in: pointer to two bytes where to store */ ulint n); /*!< in: ulint integer to be stored, >= 0, < 64k */ -/********************************************************//** -The following function is used to fetch data from two consecutive +/** The following function is used to fetch data from 2 consecutive bytes. The most significant byte is at the lowest address. -@return ulint integer, >= 0, < 64k */ +@param[in] b pointer to 2 bytes where to store +@return 2-byte integer, >= 0, < 64k */ UNIV_INLINE -ulint +uint16_t mach_read_from_2( -/*=============*/ - const byte* b) /*!< in: pointer to two bytes */ + const byte* b) MY_ATTRIBUTE((warn_unused_result)); - /********************************************************//** The following function is used to convert a 16-bit data item to the canonical format, for fast bytewise equality test @@ -105,15 +103,14 @@ mach_write_to_3( /*============*/ byte* b, /*!< in: pointer to 3 bytes where to store */ ulint n); /*!< in: ulint integer to be stored */ -/********************************************************//** -The following function is used to fetch data from 3 consecutive +/** The following function is used to fetch data from 3 consecutive bytes. The most significant byte is at the lowest address. -@return ulint integer */ +@param[in] b pointer to 3 bytes to read +@return 32 bit integer */ UNIV_INLINE -ulint +uint32_t mach_read_from_3( -/*=============*/ - const byte* b) /*!< in: pointer to 3 bytes */ + const byte* b) MY_ATTRIBUTE((warn_unused_result)); /*******************************************************//** The following function is used to store data in four consecutive @@ -124,15 +121,14 @@ mach_write_to_4( /*============*/ byte* b, /*!< in: pointer to four bytes where to store */ ulint n); /*!< in: ulint integer to be stored */ -/********************************************************//** -The following function is used to fetch data from 4 consecutive +/** The following function is used to fetch data from 4 consecutive bytes. The most significant byte is at the lowest address. -@return ulint integer */ +@param[in] b pointer to 4 bytes to read +@return 32 bit integer */ UNIV_INLINE -ulint +uint32_t mach_read_from_4( -/*=============*/ - const byte* b) /*!< in: pointer to four bytes */ + const byte* b) MY_ATTRIBUTE((warn_unused_result)); /*********************************************************//** Writes a ulint in a compressed form (1..5 bytes). diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic index 31cb873cdf6..6c879b38354 100644 --- a/storage/innobase/include/mach0data.ic +++ b/storage/innobase/include/mach0data.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -62,30 +63,28 @@ mach_write_to_2( b[1] = (byte)(n); } -/********************************************************//** -The following function is used to fetch data from one byte. +/** The following function is used to fetch data from one byte. +@param[in] b pointer to a byte to read @return ulint integer, >= 0, < 256 */ UNIV_INLINE -ulint +uint8_t mach_read_from_1( -/*=============*/ - const byte* b) /*!< in: pointer to byte */ + const byte* b) { ut_ad(b); - return((ulint)(b[0])); + return(uint8_t(*b)); } -/********************************************************//** -The following function is used to fetch data from 2 consecutive +/** The following function is used to fetch data from 2 consecutive bytes. The most significant byte is at the lowest address. -@return ulint integer */ +@param[in] b pointer to 2 bytes to read +@return 2-byte integer, >= 0, < 64k */ UNIV_INLINE -ulint +uint16_t mach_read_from_2( -/*=============*/ - const byte* b) /*!< in: pointer to 2 bytes */ + const byte* b) { - return(((ulint)(b[0]) << 8) | (ulint)(b[1])); + return(uint16_t(uint16_t(b[0]) << 8 | b[1])); } #ifndef UNIV_INNOCHECKSUM @@ -139,23 +138,21 @@ mach_write_to_3( b[2] = (byte)(n); } -/********************************************************//** -The following function is used to fetch data from 3 consecutive +/** The following function is used to fetch data from 3 consecutive bytes. The most significant byte is at the lowest address. -@return ulint integer */ +@param[in] b pointer to 3 bytes to read +@return uint32_t integer */ UNIV_INLINE -ulint +uint32_t mach_read_from_3( -/*=============*/ - const byte* b) /*!< in: pointer to 3 bytes */ + const byte* b) { ut_ad(b); - return( ((ulint)(b[0]) << 16) - | ((ulint)(b[1]) << 8) - | (ulint)(b[2]) + return( (static_cast<uint32_t>(b[0]) << 16) + | (static_cast<uint32_t>(b[1]) << 8) + | static_cast<uint32_t>(b[2]) ); } - #endif /* !UNIV_INNOCHECKSUM */ /*******************************************************//** @@ -176,21 +173,20 @@ mach_write_to_4( b[3] = (byte) n; } -/********************************************************//** -The following function is used to fetch data from 4 consecutive +/** The following function is used to fetch data from 4 consecutive bytes. The most significant byte is at the lowest address. -@return ulint integer */ +@param[in] b pointer to 4 bytes to read +@return 32 bit integer */ UNIV_INLINE -ulint +uint32_t mach_read_from_4( -/*=============*/ - const byte* b) /*!< in: pointer to four bytes */ + const byte* b) { ut_ad(b); - return( ((ulint)(b[0]) << 24) - | ((ulint)(b[1]) << 16) - | ((ulint)(b[2]) << 8) - | (ulint)(b[3]) + return( (static_cast<uint32_t>(b[0]) << 24) + | (static_cast<uint32_t>(b[1]) << 16) + | (static_cast<uint32_t>(b[2]) << 8) + | static_cast<uint32_t>(b[3]) ); } diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index 991d1179098..c44b6d38b78 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -121,7 +122,7 @@ mem_heap_create_func( ulint size, #ifdef UNIV_DEBUG const char* file_name, - ulint line, + unsigned line, #endif /* UNIV_DEBUG */ ulint type); @@ -371,7 +372,7 @@ struct mem_block_info_t { ulint magic_n;/* magic number for debugging */ #ifdef UNIV_DEBUG char file_name[8];/* file name where the mem heap was created */ - ulint line; /*!< line number where the mem heap was created */ + unsigned line; /*!< line number where the mem heap was created */ #endif /* UNIV_DEBUG */ UT_LIST_BASE_NODE_T(mem_block_t) base; /* In the first block in the the list this is the base node of the list of blocks; diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 82c90584e6f..a8292a16143 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -48,7 +49,7 @@ mem_heap_create_block_func( ulint n, /*!< in: number of bytes needed for user data */ #ifdef UNIV_DEBUG const char* file_name,/*!< in: file name where created */ - ulint line, /*!< in: line where created */ + unsigned line, /*!< in: line where created */ #endif /* UNIV_DEBUG */ ulint type); /*!< in: type of heap: MEM_HEAP_DYNAMIC or MEM_HEAP_BUFFER */ @@ -477,7 +478,7 @@ mem_heap_create_func( ulint size, #ifdef UNIV_DEBUG const char* file_name, - ulint line, + unsigned line, #endif /* UNIV_DEBUG */ ulint type) { diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index e761aaf7ec1..972209c1bf6 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -378,21 +378,21 @@ struct mtr_t { @param lock rw-lock @param file file name from where called @param line line number in file */ - inline void s_lock(rw_lock_t* lock, const char* file, ulint line); + inline void s_lock(rw_lock_t* lock, const char* file, unsigned line); /** Locks a rw-latch in X mode. NOTE: use mtr_x_lock(). @param lock rw-lock @param file file name from where called @param line line number in file */ - inline void x_lock(rw_lock_t* lock, const char* file, ulint line); + inline void x_lock(rw_lock_t* lock, const char* file, unsigned line); /** Locks a rw-latch in X mode. NOTE: use mtr_sx_lock(). @param lock rw-lock @param file file name from where called @param line line number in file */ - inline void sx_lock(rw_lock_t* lock, const char* file, ulint line); + inline void sx_lock(rw_lock_t* lock, const char* file, unsigned line); /** Acquire a tablespace X-latch. NOTE: use mtr_x_lock_space(). @@ -403,7 +403,7 @@ struct mtr_t { fil_space_t* x_lock_space( ulint space_id, const char* file, - ulint line); + unsigned line); /** Release an object in the memo stack. @param object object diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index f0354756b23..82f552f22ce 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -232,7 +233,7 @@ mtr_t::set_log_mode(mtr_log_t mode) Locks a lock in s-mode. */ void -mtr_t::s_lock(rw_lock_t* lock, const char* file, ulint line) +mtr_t::s_lock(rw_lock_t* lock, const char* file, unsigned line) { rw_lock_s_lock_inline(lock, 0, file, line); @@ -243,7 +244,7 @@ mtr_t::s_lock(rw_lock_t* lock, const char* file, ulint line) Locks a lock in x-mode. */ void -mtr_t::x_lock(rw_lock_t* lock, const char* file, ulint line) +mtr_t::x_lock(rw_lock_t* lock, const char* file, unsigned line) { rw_lock_x_lock_inline(lock, 0, file, line); @@ -254,7 +255,7 @@ mtr_t::x_lock(rw_lock_t* lock, const char* file, ulint line) Locks a lock in sx-mode. */ void -mtr_t::sx_lock(rw_lock_t* lock, const char* file, ulint line) +mtr_t::sx_lock(rw_lock_t* lock, const char* file, unsigned line) { rw_lock_sx_lock_inline(lock, 0, file, line); diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 95879a43872..0725a5405a4 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation +Copyright (c) 2017, 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 @@ -168,11 +168,6 @@ enum mlog_id_t { /** mark compact clustered index record deleted */ MLOG_COMP_REC_CLUST_DELETE_MARK = 39, - /** mark compact secondary index record deleted; this log - record type is redundant, as MLOG_REC_SEC_DELETE_MARK is - independent of the record format. */ - MLOG_COMP_REC_SEC_DELETE_MARK = 40, - /** update of a compact record, preserves record field sizes */ MLOG_COMP_REC_UPDATE_IN_PLACE = 41, diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index ffe7b1a48bf..e30c427dff6 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -110,7 +110,7 @@ whole block gets written. This should be true even in most cases of a crash: if this fails for a log block, then it is equivalent to a media failure in the log. */ -#define OS_FILE_LOG_BLOCK_SIZE 512 +#define OS_FILE_LOG_BLOCK_SIZE 512U /** Options for os_file_create_func @{ */ enum os_file_create_t { @@ -861,7 +861,7 @@ pfs_os_file_create_simple_func( bool read_only, bool* success, const char* src_file, - ulint src_line) + uint src_line) MY_ATTRIBUTE((warn_unused_result)); /** NOTE! Please use the corresponding macro @@ -892,7 +892,7 @@ pfs_os_file_create_simple_no_error_handling_func( bool read_only, bool* success, const char* src_file, - ulint src_line) + uint src_line) MY_ATTRIBUTE((warn_unused_result)); /** NOTE! Please use the corresponding macro os_file_create(), not directly @@ -926,7 +926,7 @@ pfs_os_file_create_func( bool read_only, bool* success, const char* src_file, - ulint src_line) + uint src_line) MY_ATTRIBUTE((warn_unused_result)); /** NOTE! Please use the corresponding macro os_file_close(), not directly @@ -941,7 +941,7 @@ bool pfs_os_file_close_func( os_file_t file, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_read(), not directly this function! @@ -964,7 +964,7 @@ pfs_os_file_read_func( os_offset_t offset, ulint n, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_read_no_error_handling(), not directly this function! @@ -990,7 +990,7 @@ pfs_os_file_read_no_error_handling_func( ulint n, ulint* o, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_aio(), not directly this function! @@ -1028,7 +1028,7 @@ pfs_os_aio_func( fil_node_t* m1, void* m2, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_write(), not directly this function! @@ -1054,7 +1054,7 @@ pfs_os_file_write_func( os_offset_t offset, ulint n, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_flush(), not directly this function! @@ -1070,7 +1070,7 @@ bool pfs_os_file_flush_func( os_file_t file, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_rename(), not directly this function! @@ -1089,7 +1089,7 @@ pfs_os_file_rename_func( const char* oldpath, const char* newpath, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_delete(), not directly @@ -1107,7 +1107,7 @@ pfs_os_file_delete_func( mysql_pfs_key_t key, const char* name, const char* src_file, - ulint src_line); + uint src_line); /** NOTE! Please use the corresponding macro os_file_delete_if_exists(), not @@ -1127,7 +1127,7 @@ pfs_os_file_delete_if_exists_func( const char* name, bool* exist, const char* src_file, - ulint src_line); + uint src_line); #else /* UNIV_PFS_IO */ diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 5c7c4d45ca6..807d3254b9d 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -52,7 +52,7 @@ pfs_os_file_create_simple_func( bool read_only, bool* success, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -101,7 +101,7 @@ pfs_os_file_create_simple_no_error_handling_func( bool read_only, bool* success, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -152,7 +152,7 @@ pfs_os_file_create_func( bool read_only, bool* success, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -184,7 +184,7 @@ bool pfs_os_file_close_func( os_file_t file, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -236,7 +236,7 @@ pfs_os_aio_func( fil_node_t* m1, void* m2, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -278,7 +278,7 @@ pfs_os_file_read_func( os_offset_t offset, ulint n, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -321,7 +321,7 @@ pfs_os_file_read_no_error_handling_func( ulint n, ulint* o, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -361,7 +361,7 @@ pfs_os_file_write_func( os_offset_t offset, ulint n, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -392,7 +392,7 @@ bool pfs_os_file_flush_func( os_file_t file, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -424,7 +424,7 @@ pfs_os_file_rename_func( const char* oldpath, const char* newpath, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; @@ -456,7 +456,7 @@ pfs_os_file_delete_func( mysql_pfs_key_t key, const char* name, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -489,7 +489,7 @@ pfs_os_file_delete_if_exists_func( const char* name, bool* exist, const char* src_file, - ulint src_line) + uint src_line) { PSI_file_locker_state state; struct PSI_file_locker* locker = NULL; @@ -504,4 +504,3 @@ pfs_os_file_delete_if_exists_func( return(result); } #endif /* UNIV_PFS_IO */ - diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index 2bb922cc829..731817e740a 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -36,8 +36,6 @@ Created 10/4/1994 Heikki Tuuri #include "gis0type.h" -#define PAGE_CUR_ADAPT - #ifdef UNIV_DEBUG /*********************************************************//** Gets pointer to the page frame where the cursor is positioned. @@ -297,6 +295,7 @@ page_cur_search_with_match( fields in lower limit record */ page_cur_t* cursor, /*!< out: page cursor */ rtr_info_t* rtr_info);/*!< in/out: rtree search stack */ +#ifdef BTR_CUR_HASH_ADAPT /** Search the right position for a page cursor. @param[in] block buffer block @param[in] index index tree @@ -322,6 +321,7 @@ page_cur_search_with_match_bytes( ulint* ilow_matched_fields, ulint* ilow_matched_bytes, page_cur_t* cursor); +#endif /* BTR_CUR_HASH_ADAPT */ /***********************************************************//** Positions a page cursor on a randomly chosen user record on a page. If there are no user records, sets the cursor on the infimum record. */ diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index a70ca3da8d8..3940931125e 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -252,7 +252,7 @@ page_header_set_ptr( if (ptr == NULL) { offs = 0; } else { - offs = ptr - page; + offs = ulint(ptr - page); } ut_ad((field != PAGE_HEAP_TOP) || offs); @@ -1248,11 +1248,9 @@ page_mem_free( ut_ad(rec_offs_validate(rec, index, offsets)); free = page_header_get_ptr(page, PAGE_FREE); - bool scrub = srv_immediate_scrub_data_uncompressed; - if (scrub) { + if (srv_immediate_scrub_data_uncompressed) { /* scrub record */ - uint size = rec_offs_data_size(offsets); - memset(rec, 0, size); + memset(rec, 0, rec_offs_data_size(offsets)); } page_rec_set_next(rec, free); diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h index ca173db9b6d..30a996df0a6 100644 --- a/storage/innobase/include/page0size.h +++ b/storage/innobase/include/page0size.h @@ -82,7 +82,7 @@ public: ssize = (0 == ssize) ? UNIV_PAGE_SSIZE_ORIG : ssize; /* Convert from a 'log2 minus 9' to a page size in bytes. */ - const ulint size = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize); + const unsigned size = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize); ut_ad(size <= UNIV_PAGE_SIZE_MAX); ut_ad(size <= (1 << PAGE_SIZE_T_SIZE_BITS)); @@ -102,7 +102,7 @@ public: /* Convert from a 'log2 minus 9' to a page size in bytes. */ - const ulint phy + const unsigned phy = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize); ut_ad(phy <= UNIV_ZIP_SIZE_MAX); diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index 4a32595af66..f4da2b55385 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -2,6 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. +Copyright (c) 2017, 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,11 +70,11 @@ extern uint page_zip_level; + DATA_TRX_ID_LEN \ + DATA_ROLL_PTR_LEN) /** Mask of record offsets */ -#define PAGE_ZIP_DIR_SLOT_MASK 0x3fff +#define PAGE_ZIP_DIR_SLOT_MASK 0x3fffU /** 'owned' flag */ -#define PAGE_ZIP_DIR_SLOT_OWNED 0x4000 +#define PAGE_ZIP_DIR_SLOT_OWNED 0x4000U /** 'deleted' flag */ -#define PAGE_ZIP_DIR_SLOT_DEL 0x8000 +#define PAGE_ZIP_DIR_SLOT_DEL 0x8000U /* Whether or not to log compressed page images to avoid possible compression algorithm changes in zlib. */ diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic index 9cc54dc42fa..5f754e1f993 100644 --- a/storage/innobase/include/page0zip.ic +++ b/storage/innobase/include/page0zip.ic @@ -2,6 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. +Copyright (c) 2017, 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 @@ -133,11 +134,11 @@ page_zip_set_size( ulint size) /*!< in: size in bytes */ { if (size) { - int ssize; + unsigned ssize; ut_ad(ut_is_2pow(size)); - for (ssize = 1; size > (ulint) (512 << ssize); ssize++) { + for (ssize = 1; size > (512U << ssize); ssize++) { } page_zip->ssize = ssize; @@ -268,9 +269,9 @@ page_zip_max_ins_size( trailer_len += PAGE_ZIP_DIR_SLOT_SIZE; - return((lint) page_zip_get_size(page_zip) - - trailer_len - page_zip->m_end - - (REC_N_NEW_EXTRA_BYTES - 2)); + return(lint(page_zip_get_size(page_zip) + - trailer_len - page_zip->m_end + - (REC_N_NEW_EXTRA_BYTES - 2))); } /**********************************************************************//** diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index ed700139b53..4b82a6b05b9 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -458,7 +459,7 @@ rec_get_offsets_func( (ULINT_UNDEFINED if all fields) */ #ifdef UNIV_DEBUG const char* file, /*!< in: file name where called */ - ulint line, /*!< in: line number where called */ + unsigned line, /*!< in: line number where called */ #endif /* UNIV_DEBUG */ mem_heap_t** heap) /*!< in/out: memory heap */ #ifdef UNIV_DEBUG diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index 4038c32b9c0..00a32942de2 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -153,7 +154,7 @@ row_ins_index_entry_big_rec_func( #ifndef DBUG_OFF const void* thd, /*!< in: connection, or NULL */ #endif /* DBUG_OFF */ - ulint line) /*!< in: line number of caller */ + unsigned line) /*!< in: line number of caller */ MY_ATTRIBUTE((nonnull(1,2,3,4,5,6), warn_unused_result)); #ifdef DBUG_OFF # define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd,file,line) \ diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 9e71ee42bb0..1b61c475c6f 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2017, 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 @@ -283,8 +283,8 @@ row_merge_create_index( /*********************************************************************//** Check if a transaction can use an index. -@return TRUE if index can be used by the transaction else FALSE */ -ibool +@return whether the index can be used by the transaction */ +bool row_merge_is_index_usable( /*======================*/ const trx_t* trx, /*!< in: transaction */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 607f7c96389..0e4ebafc990 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -337,7 +338,7 @@ row_mysql_lock_data_dictionary_func( /*================================*/ trx_t* trx, /*!< in/out: transaction */ const char* file, /*!< in: file name */ - ulint line); /*!< in: line number */ + unsigned line); /*!< in: line number */ #define row_mysql_lock_data_dictionary(trx) \ row_mysql_lock_data_dictionary_func(trx, __FILE__, __LINE__) /*********************************************************************//** @@ -354,7 +355,7 @@ row_mysql_freeze_data_dictionary_func( /*==================================*/ trx_t* trx, /*!< in/out: transaction */ const char* file, /*!< in: file name */ - ulint line); /*!< in: line number */ + unsigned line); /*!< in: line number */ #define row_mysql_freeze_data_dictionary(trx) \ row_mysql_freeze_data_dictionary_func(trx, __FILE__, __LINE__) /*********************************************************************//** diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic index 8b794e47a07..18c72309930 100644 --- a/storage/innobase/include/row0upd.ic +++ b/storage/innobase/include/row0upd.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -97,10 +98,10 @@ upd_field_set_field_no( dict_index_t* index, /*!< in: index */ trx_t* trx) /*!< in: transaction */ { - upd_field->field_no = field_no; + upd_field->field_no = unsigned(field_no); upd_field->orig_len = 0; - if (field_no >= dict_index_get_n_fields(index)) { + if (UNIV_UNLIKELY(field_no >= dict_index_get_n_fields(index))) { ib::error() << " trying to access field " << field_no << " in " << index->name @@ -125,19 +126,10 @@ upd_field_set_v_field_no( ulint field_no, dict_index_t* index) { - upd_field->field_no = field_no; + ut_a(field_no < dict_table_get_n_v_cols(index->table)); + upd_field->field_no = unsigned(field_no); upd_field->orig_len = 0; - if (field_no >= dict_table_get_n_v_cols(index->table)) { - ib::error() - << " trying to access virtual field " << field_no - << " in " << index->name - << " of table " << index->table->name - << " which contains only " << index->table->n_v_cols - << " virutal columns"; - ut_ad(0); - } - dict_col_copy_type(&dict_table_get_nth_v_col( index->table, field_no)->m_col, dfield_get_type(&upd_field->new_val)); diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 5c19e735806..3697604425c 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -361,16 +361,20 @@ enum monitor_id_t { MONITOR_INDEX_REORG_SUCCESSFUL, MONITOR_INDEX_DISCARD, +#ifdef BTR_CUR_HASH_ADAPT /* Adaptive Hash Index related counters */ MONITOR_MODULE_ADAPTIVE_HASH, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH, +#endif /* BTR_CUR_HASH_ADAPT */ MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE, +#ifdef BTR_CUR_HASH_ADAPT MONITOR_ADAPTIVE_HASH_PAGE_ADDED, MONITOR_ADAPTIVE_HASH_PAGE_REMOVED, MONITOR_ADAPTIVE_HASH_ROW_ADDED, MONITOR_ADAPTIVE_HASH_ROW_REMOVED, MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND, MONITOR_ADAPTIVE_HASH_ROW_UPDATED, +#endif /* BTR_CUR_HASH_ADAPT */ /* Tablespace related counters */ MONITOR_MODULE_FIL_SYSTEM, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index a8c962d4a45..cbf01564cce 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -571,9 +571,6 @@ that semaphore times out in InnoDB */ #define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 extern ulong srv_fatal_semaphore_wait_threshold; -/** Enable semaphore request instrumentation */ -extern my_bool srv_instrument_semaphores; - /** Buffer pool dump status frequence in percentages */ extern ulong srv_buf_dump_status_frequency; diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h index bc419a9be8f..23b9b746d20 100644 --- a/storage/innobase/include/sync0arr.h +++ b/storage/innobase/include/sync0arr.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2017, 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,7 +49,7 @@ sync_array_get_and_reserve_cell( void* object, /*!< in: pointer to the object to wait for */ ulint type, /*!< in: lock request type */ const char* file, /*!< in: file where requested */ - ulint line, /*!< in: line where requested */ + unsigned line, /*!< in: line where requested */ sync_cell_t** cell); /*!< out: the cell reserved, never NULL */ /******************************************************************//** Reserves a wait array cell for waiting for an object. @@ -60,7 +60,7 @@ sync_array_reserve_cell( void* object, /*!< in: pointer to the object to wait for */ ulint type, /*!< in: lock request type */ const char* file, /*!< in: file where requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** This function should be called when a thread starts to wait on diff --git a/storage/innobase/include/sync0arr.ic b/storage/innobase/include/sync0arr.ic index a15e2176278..cd1d8e27625 100644 --- a/storage/innobase/include/sync0arr.ic +++ b/storage/innobase/include/sync0arr.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -61,7 +62,7 @@ sync_array_get_and_reserve_cell( void* object, /*!< in: pointer to the object to wait for */ ulint type, /*!< in: lock request type */ const char* file, /*!< in: file where requested */ - ulint line, /*!< in: line where requested */ + unsigned line, /*!< in: line where requested */ sync_cell_t** cell) /*!< out: the cell reserved, never NULL */ { sync_array_t* sync_arr = NULL; diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h index 0eaefc7167a..1a430328f0e 100644 --- a/storage/innobase/include/sync0policy.h +++ b/storage/innobase/include/sync0policy.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -70,7 +71,7 @@ public: void locked( const Mutex* mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW { m_mutex = mutex; @@ -92,7 +93,7 @@ public: m_filename = NULL; - m_line = ULINT_UNDEFINED; + m_line = 0; } /** Print information about the latch @@ -134,7 +135,7 @@ public: const char* m_filename; /** Line mumber in filename */ - ulint m_line; + unsigned m_line; /** Thread ID of the thread that own(ed) the mutex */ os_thread_id_t m_thread_id; @@ -176,7 +177,7 @@ public: void enter( const Mutex* mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW; /** Called when the mutex is locked @@ -186,7 +187,7 @@ public: void locked( const Mutex* mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW; /** Called when the mutex is released @@ -210,7 +211,7 @@ public: } /** @return the name of the file from the mutex was acquired */ - ulint get_enter_line() const + unsigned get_enter_line() const UNIV_NOTHROW { return(m_context.m_line); @@ -240,7 +241,7 @@ struct NoPolicy { void init(const Mutex&, latch_id_t, const char*, uint32_t) UNIV_NOTHROW { } void destroy() UNIV_NOTHROW { } - void enter(const Mutex&, const char*, ulint line) UNIV_NOTHROW { } + void enter(const Mutex&, const char*, unsigned line) UNIV_NOTHROW { } void add(uint32_t, uint32_t) UNIV_NOTHROW { } void locked(const Mutex&, const char*, ulint) UNIV_NOTHROW { } void release(const Mutex&) UNIV_NOTHROW { } @@ -293,7 +294,7 @@ public: meta.get_counter()->single_register(&m_count); - sync_file_created_register(this, filename, line); + sync_file_created_register(this, filename, uint16_t(line)); ut_d(MutexDebug<MutexType>::init(m_id)); } @@ -341,7 +342,7 @@ public: void enter( const MutexType& mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW { ut_d(MutexDebug<MutexType>::enter(&mutex, filename, line)); @@ -354,7 +355,7 @@ public: void locked( const MutexType& mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW { ut_d(MutexDebug<MutexType>::locked(&mutex, filename, line)); @@ -492,7 +493,7 @@ public: void locked( const MutexType& mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW { ut_d(MutexDebug<MutexType>::locked(&mutex, filename, line)); @@ -513,7 +514,7 @@ public: void enter( const MutexType& mutex, const char* filename, - ulint line) + unsigned line) UNIV_NOTHROW { ut_d(MutexDebug<MutexType>::enter(&mutex, filename, line)); diff --git a/storage/innobase/include/sync0policy.ic b/storage/innobase/include/sync0policy.ic index f7598fe7854..f3526bbfef5 100644 --- a/storage/innobase/include/sync0policy.ic +++ b/storage/innobase/include/sync0policy.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2015, 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 the terms of the GNU General Public License as published by the Free Software @@ -57,7 +58,7 @@ template <typename Mutex> void MutexDebug<Mutex>::enter( const Mutex* mutex, const char* name, - ulint line) + unsigned line) UNIV_NOTHROW { ut_ad(!is_owned()); @@ -75,7 +76,7 @@ template <typename Mutex> void MutexDebug<Mutex>::locked( const Mutex* mutex, const char* name, - ulint line) + unsigned line) UNIV_NOTHROW { ut_ad(!is_owned()); diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h index 9a9da2d145a..cf4a646cdcc 100644 --- a/storage/innobase/include/sync0rw.h +++ b/storage/innobase/include/sync0rw.h @@ -2,6 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. +Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -38,9 +39,6 @@ Created 9/11/1995 Heikki Tuuri #include "os0event.h" #include "ut0mutex.h" -/** Enable semaphore request instrumentation */ -extern my_bool srv_instrument_semaphores; - /** Counters for RW locks. */ struct rw_lock_stats_t { typedef ib_counter_t<int64_t, IB_N_SLOTS> int64_counter_t; @@ -127,10 +125,10 @@ if MySQL performance schema is enabled and "UNIV_PFS_RWLOCK" is defined, the rwlock are instrumented with performance schema probes. */ # ifdef UNIV_DEBUG # define rw_lock_create(K, L, level) \ - rw_lock_create_func((L), (level), #L, __FILE__, __LINE__) + rw_lock_create_func((L), (level), __FILE__, __LINE__) # else /* UNIV_DEBUG */ # define rw_lock_create(K, L, level) \ - rw_lock_create_func((L), #L, __FILE__, __LINE__) + rw_lock_create_func((L), __FILE__, __LINE__) # endif /* UNIV_DEBUG */ /**************************************************************//** @@ -215,10 +213,10 @@ unlocking, not the corresponding function. */ /* Following macros point to Performance Schema instrumented functions. */ # ifdef UNIV_DEBUG # define rw_lock_create(K, L, level) \ - pfs_rw_lock_create_func((K), (L), (level), #L, __FILE__, __LINE__) + pfs_rw_lock_create_func((K), (L), (level), __FILE__, __LINE__) # else /* UNIV_DEBUG */ # define rw_lock_create(K, L, level) \ - pfs_rw_lock_create_func((K), (L), #L, __FILE__, __LINE__) + pfs_rw_lock_create_func((K), (L), __FILE__, __LINE__) # endif /* UNIV_DEBUG */ /****************************************************************** @@ -303,9 +301,8 @@ rw_lock_create_func( #ifdef UNIV_DEBUG latch_level_t level, /*!< in: level */ #endif /* UNIV_DEBUG */ - const char* cmutex_name, /*!< in: mutex name */ const char* cfile_name, /*!< in: file name where created */ - ulint cline); /*!< in: file line where created */ + unsigned cline); /*!< in: file line where created */ /******************************************************************//** Calling this function is obligatory only if the memory buffer containing the rw-lock is freed. Removes an rw-lock object from the global list. The @@ -337,7 +334,7 @@ rw_lock_s_lock_low( /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** NOTE! Use the corresponding macro, not directly this function, except if you supply the file name and line number. Lock an rw-lock in shared mode @@ -353,7 +350,7 @@ rw_lock_s_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in exclusive mode for the current thread if the lock can be @@ -365,7 +362,7 @@ rw_lock_x_lock_func_nowait( /*=======================*/ rw_lock_t* lock, /*!< in: pointer to rw-lock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Releases a shared mode lock. */ UNIV_INLINE @@ -394,7 +391,7 @@ rw_lock_x_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Low-level function for acquiring an sx lock. @return FALSE if did not succeed, TRUE if success. */ @@ -405,7 +402,7 @@ rw_lock_sx_lock_low( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** NOTE! Use the corresponding macro, not directly this function! Lock an rw-lock in SX mode for the current thread. If the rw-lock is locked @@ -422,7 +419,7 @@ rw_lock_sx_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Releases an exclusive mode lock. */ UNIV_INLINE @@ -637,11 +634,6 @@ struct rw_lock_t /** Line number where last time x-locked */ unsigned last_x_line:14; - const char* lock_name; - const char* file_name;/*!< File name where the lock was obtained */ - ulint line; /*!< Line where the rw-lock was locked */ - os_thread_id_t thread_id; - /** Count of os_waits. May not be accurate */ uint32_t count_os_wait; @@ -696,7 +688,7 @@ struct rw_lock_debug_t { ulint lock_type; /*!< Type of the lock: RW_LOCK_X, RW_LOCK_S, RW_LOCK_X_WAIT */ const char* file_name;/*!< File name where the lock was obtained */ - ulint line; /*!< Line where the rw-lock was locked */ + unsigned line; /*!< Line where the rw-lock was locked */ UT_LIST_NODE_T(rw_lock_debug_t) list; /*!< Debug structs are linked in a two-way list */ @@ -744,9 +736,8 @@ pfs_rw_lock_create_func( #ifdef UNIV_DEBUG latch_level_t level, /*!< in: level */ #endif /* UNIV_DEBUG */ - const char* cmutex_name, /*!< in: mutex name */ const char* cfile_name, /*!< in: file name where created */ - ulint cline); /*!< in: file line where created */ + unsigned cline); /*!< in: file line where created */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_x_lock_func() @@ -760,7 +751,7 @@ pfs_rw_lock_x_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_x_lock_func_nowait() @@ -772,7 +763,7 @@ pfs_rw_lock_x_lock_func_nowait( /*===========================*/ rw_lock_t* lock, /*!< in: pointer to rw-lock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly @@ -785,7 +776,7 @@ pfs_rw_lock_s_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_s_lock_func() NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly @@ -800,7 +791,7 @@ pfs_rw_lock_s_lock_low( lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_x_lock_func() NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly @@ -813,7 +804,7 @@ pfs_rw_lock_x_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_s_unlock_func() NOTE! Please use the corresponding macro rw_lock_s_unlock(), not directly @@ -854,7 +845,7 @@ pfs_rw_lock_sx_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_sx_lock_nowait() NOTE! Please use the corresponding macro, not directly @@ -867,7 +858,7 @@ pfs_rw_lock_sx_lock_low( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Performance schema instrumented wrap function for rw_lock_sx_unlock_func() NOTE! Please use the corresponding macro rw_lock_sx_unlock(), not directly diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index d67e26d961d..21872cc8bee 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -2,6 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. +Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -44,7 +45,7 @@ rw_lock_s_lock_spin( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ #ifdef UNIV_DEBUG /******************************************************************//** Inserts the debug information for an rw-lock. */ @@ -55,7 +56,7 @@ rw_lock_add_debug_info( ulint pass, /*!< in: pass value */ ulint lock_type, /*!< in: lock type */ const char* file_name, /*!< in: file where requested */ - ulint line); /*!< in: line where requested */ + unsigned line); /*!< in: line where requested */ /******************************************************************//** Removes a debug information struct for an rw-lock. */ void @@ -236,7 +237,7 @@ rw_lock_s_lock_low( /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { if (!rw_lock_lock_word_decr(lock, 1, 0)) { /* Locking did not succeed */ @@ -250,14 +251,6 @@ rw_lock_s_lock_low( lock->last_s_file_name = file_name; lock->last_s_line = line; - /* - if (srv_instrument_semaphores) { - lock->thread_id = os_thread_get_curr_id(); - lock->file_name = file_name; - lock->line = line; - } - */ - return(TRUE); /* locking succeeded */ } @@ -275,7 +268,7 @@ rw_lock_s_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { /* NOTE: As we do not know the thread ids for threads which have s-locked a latch, and s-lockers will be served only after waiting @@ -310,7 +303,7 @@ rw_lock_x_lock_func_nowait( /*=======================*/ rw_lock_t* lock, /*!< in: pointer to rw-lock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { lint oldval = X_LOCK_DECR; @@ -342,14 +335,6 @@ rw_lock_x_lock_func_nowait( ut_d(rw_lock_add_debug_info(lock, 0, RW_LOCK_X, file_name, line)); - /* - if (srv_instrument_semaphores) { - lock->thread_id = os_thread_get_curr_id(); - lock->file_name = file_name; - lock->line = line; - } - */ - lock->last_x_file_name = file_name; lock->last_x_line = line; @@ -507,9 +492,8 @@ pfs_rw_lock_create_func( # ifdef UNIV_DEBUG latch_level_t level, /*!< in: level */ # endif /* UNIV_DEBUG */ - const char* cmutex_name, /*!< in: mutex name */ const char* cfile_name, /*!< in: file name where created */ - ulint cline) /*!< in: file line where created */ + unsigned cline) /*!< in: file line where created */ { ut_d(new(lock) rw_lock_t()); @@ -521,7 +505,6 @@ pfs_rw_lock_create_func( #ifdef UNIV_DEBUG level, #endif /* UNIV_DEBUG */ - cmutex_name, cfile_name, cline); } @@ -537,7 +520,7 @@ pfs_rw_lock_x_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { if (lock->pfs_psi != NULL) { PSI_rwlock_locker* locker; @@ -575,7 +558,7 @@ pfs_rw_lock_x_lock_func_nowait( rw_lock_t* lock, /*!< in: pointer to rw-lock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ibool ret; @@ -634,7 +617,7 @@ pfs_rw_lock_s_lock_func( thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { if (lock->pfs_psi != NULL) { PSI_rwlock_locker* locker; @@ -669,7 +652,7 @@ pfs_rw_lock_sx_lock_func( thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { if (lock->pfs_psi != NULL) { PSI_rwlock_locker* locker; @@ -704,7 +687,7 @@ pfs_rw_lock_s_lock_low( lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ibool ret; @@ -744,7 +727,7 @@ pfs_rw_lock_sx_lock_low( lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ibool ret; diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index 68b6a44dc25..736c5454711 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2017, 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 @@ -33,11 +34,6 @@ Created 9/5/1995 Heikki Tuuri #include "ut0new.h" #include "ut0counter.h" -#if defined(UNIV_DEBUG) && !defined(UNIV_INNOCHECKSUM) -/** Set when InnoDB has invoked exit(). */ -extern bool innodb_calling_exit; -#endif /* UNIV_DEBUG && !UNIV_INNOCHECKSUM */ - #ifdef _WIN32 /** Native mutex */ typedef CRITICAL_SECTION sys_mutex_t; @@ -436,7 +432,7 @@ struct OSMutex { void destroy() UNIV_NOTHROW { - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); #ifdef _WIN32 DeleteCriticalSection((LPCRITICAL_SECTION) &m_mutex); #else @@ -458,7 +454,7 @@ struct OSMutex { void exit() UNIV_NOTHROW { - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); #ifdef _WIN32 LeaveCriticalSection(&m_mutex); #else @@ -471,7 +467,7 @@ struct OSMutex { void enter() UNIV_NOTHROW { - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); #ifdef _WIN32 EnterCriticalSection((LPCRITICAL_SECTION) &m_mutex); #else @@ -484,7 +480,7 @@ struct OSMutex { bool try_lock() UNIV_NOTHROW { - ut_ad(innodb_calling_exit || !m_freed); + ut_ad(!m_freed); #ifdef _WIN32 return(TryEnterCriticalSection(&m_mutex) != 0); #else @@ -1070,6 +1066,7 @@ struct sync_check_functor_t { virtual bool result() const = 0; }; +#ifdef BTR_CUR_HASH_ADAPT /** Functor to check whether the calling thread owns the btr search mutex. */ struct btrsea_sync_check : public sync_check_functor_t { @@ -1116,6 +1113,7 @@ private: /** If the caller owns the search latch */ const bool m_has_search_latch; }; +#endif /* BTR_CUR_HASH_ADAPT */ /** Functor to check for dictionay latching constraints. */ struct dict_sync_check : public sync_check_functor_t { diff --git a/storage/innobase/include/trx0i_s.h b/storage/innobase/include/trx0i_s.h index f588d820743..17a297527af 100644 --- a/storage/innobase/include/trx0i_s.h +++ b/storage/innobase/include/trx0i_s.h @@ -162,8 +162,10 @@ struct i_s_trx_row_t { /*!< check_foreigns in trx_t */ const char* trx_foreign_key_error; /*!< detailed_error in trx_t */ +#ifdef BTR_CUR_HASH_ADAPT ibool trx_has_search_latch; /*!< has_search_latch in trx_t */ +#endif /* BTR_CUR_HASH_ADAPT */ ulint trx_is_read_only; /*!< trx_t::read_only */ ulint trx_is_autocommit_non_locking; diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 90f4604043b..fc3d90b478d 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -353,16 +354,16 @@ record */ fields of the record can change */ #define TRX_UNDO_DEL_MARK_REC 14 /* delete marking of a record; fields do not change */ -#define TRX_UNDO_CMPL_INFO_MULT 16 /* compilation info is multiplied by +#define TRX_UNDO_CMPL_INFO_MULT 16U /* compilation info is multiplied by this and ORed to the type above */ -#define TRX_UNDO_UPD_EXTERN 128 /* This bit can be ORed to type_cmpl +#define TRX_UNDO_UPD_EXTERN 128U /* This bit can be ORed to type_cmpl to denote that we updated external storage fields: used by purge to free the external storage */ /* Operation type flags used in trx_undo_report_row_operation */ -#define TRX_UNDO_INSERT_OP 1 -#define TRX_UNDO_MODIFY_OP 2 +#define TRX_UNDO_INSERT_OP 1U +#define TRX_UNDO_MODIFY_OP 2U #ifndef UNIV_NONINL #include "trx0rec.ic" diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index d652c2162dc..efae0556469 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2016, 2017, 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,12 +58,14 @@ class FlushObserver; /** Dummy session used currently in MySQL interface */ extern sess_t* trx_dummy_sess; -/** -Releases the search latch if trx has reserved it. -@param[in,out] trx Transaction that may own the AHI latch */ -UNIV_INLINE -void -trx_search_latch_release_if_reserved(trx_t* trx); +#ifdef BTR_CUR_HASH_ADAPT +/** Assert that the transaction is not holding the adaptive hash index latch. +@param[in] trx transaction */ +# define trx_assert_no_search_latch(trx) \ + ut_ad(!trx->has_search_latch) +#else /* BTR_CUR_HASH_ADAPT */ +# define trx_assert_no_search_latch(trx) +#endif /** Set flush observer for the transaction @param[in/out] trx transaction struct @@ -1075,9 +1077,11 @@ struct trx_t { flush the log in trx_commit_complete_for_mysql() */ ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ +#ifdef BTR_CUR_HASH_ADAPT bool has_search_latch; /*!< TRUE if this trx has latched the search system latch in S-mode */ +#endif /* BTR_CUR_HASH_ADAPT */ trx_dict_op_t dict_operation; /**< @see enum trx_dict_op_t */ /* Fields protected by the srv_conc_mutex. */ @@ -1238,7 +1242,7 @@ struct trx_t { read-write. */ /*------------------------------*/ #ifdef UNIV_DEBUG - ulint start_line; /*!< Track where it was started from */ + unsigned start_line; /*!< Track where it was started from */ const char* start_file; /*!< Filename where it was started */ #endif /* UNIV_DEBUG */ @@ -1343,8 +1347,8 @@ trx_is_started( /* Treatment of duplicate values (trx->duplicates; for example, in inserts). Multiple flags can be combined with bitwise OR. */ -#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */ -#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */ +#define TRX_DUP_IGNORE 1U /* duplicate rows are to be updated */ +#define TRX_DUP_REPLACE 2U /* duplicate rows are to be replaced */ /** Commit node states */ @@ -1478,7 +1482,7 @@ private: /* Only the owning thread should release the latch. */ - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); trx_mutex_enter(trx); @@ -1531,7 +1535,7 @@ private: /* Only the owning thread should release the latch. */ - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); trx_mutex_enter(trx); diff --git a/storage/innobase/include/trx0trx.ic b/storage/innobase/include/trx0trx.ic index f0ed9b61c5a..14d519351e4 100644 --- a/storage/innobase/include/trx0trx.ic +++ b/storage/innobase/include/trx0trx.ic @@ -213,16 +213,6 @@ ok: trx->dict_operation = op; } -/** -Releases the search latch if trx has reserved it. -@param[in,out] trx Transaction that may own the AHI latch */ -UNIV_INLINE -void -trx_search_latch_release_if_reserved(trx_t* trx) -{ - ut_a(!trx->has_search_latch); -} - /********************************************************************//** Check if redo rseg is modified for insert/update. */ UNIV_INLINE diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index 37a53f900eb..6fd5b1ab678 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -62,7 +63,7 @@ is set. */ static const ib_uint32_t TRX_FORCE_ROLLBACK_ASYNC = 1 << 30; /** Mark the transaction for forced rollback */ -static const ib_uint32_t TRX_FORCE_ROLLBACK = 1 << 31; +static const ib_uint32_t TRX_FORCE_ROLLBACK = 1U << 31; /** For masking out the above four flags */ static const ib_uint32_t TRX_FORCE_ROLLBACK_MASK = 0x1FFFFFFF; diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 908fb60e956..edb018c46e2 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -302,7 +302,7 @@ definitions: */ /** The following alignment is used in memory allocations in memory heap management to ensure correct alignment for doubles etc. */ -#define UNIV_MEM_ALIGNMENT 8 +#define UNIV_MEM_ALIGNMENT 8U /* DATABASE VERSION CONTROL @@ -400,19 +400,19 @@ and 2 bits for flags. This limits the uncompressed page size to 16k. #define UNIV_PAGE_SSIZE_ORIG (UNIV_PAGE_SIZE_SHIFT_ORIG - 9) /** Minimum page size InnoDB currently supports. */ -#define UNIV_PAGE_SIZE_MIN (1 << UNIV_PAGE_SIZE_SHIFT_MIN) +#define UNIV_PAGE_SIZE_MIN (1U << UNIV_PAGE_SIZE_SHIFT_MIN) /** Maximum page size InnoDB currently supports. */ -#define UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX) +#define UNIV_PAGE_SIZE_MAX (1U << UNIV_PAGE_SIZE_SHIFT_MAX) /** Default page size for InnoDB tablespaces. */ -#define UNIV_PAGE_SIZE_DEF (1 << UNIV_PAGE_SIZE_SHIFT_DEF) +#define UNIV_PAGE_SIZE_DEF (1U << UNIV_PAGE_SIZE_SHIFT_DEF) /** Original 16k page size for InnoDB tablespaces. */ -#define UNIV_PAGE_SIZE_ORIG (1 << UNIV_PAGE_SIZE_SHIFT_ORIG) +#define UNIV_PAGE_SIZE_ORIG (1U << UNIV_PAGE_SIZE_SHIFT_ORIG) /** Smallest compressed page size */ -#define UNIV_ZIP_SIZE_MIN (1 << UNIV_ZIP_SIZE_SHIFT_MIN) +#define UNIV_ZIP_SIZE_MIN (1U << UNIV_ZIP_SIZE_SHIFT_MIN) /** Largest compressed page size */ -#define UNIV_ZIP_SIZE_MAX (1 << UNIV_ZIP_SIZE_SHIFT_MAX) +#define UNIV_ZIP_SIZE_MAX (1U << UNIV_ZIP_SIZE_SHIFT_MAX) /** Largest possible ssize for an uncompressed page. (The convention 'ssize' is used for 'log2 minus 9' or the number of @@ -584,7 +584,7 @@ contains the sum of the following flag and the locally stored len. */ /* Tell the compiler that 'expr' probably evaluates to 'constant'. */ # define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant) /* Tell the compiler that a pointer is likely to be NULL */ -# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ulint) ptr, 0) +# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ptr) != 0, 0) /* Minimize cache-miss latency by moving data at addr into a cache before it is read. */ # define UNIV_PREFETCH_R(addr) __builtin_prefetch(addr, 0, 3) diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 1a61ed84a38..7d212dfcff4 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -43,7 +44,7 @@ ut_dbg_assertion_failed( /*====================*/ const char* expr, /*!< in: the failed assertion */ const char* file, /*!< in: source file containing the assertion */ - ulint line) /*!< in: line number of the assertion */ + unsigned line) /*!< in: line number of the assertion */ UNIV_COLD MY_ATTRIBUTE((nonnull(2), noreturn)); /** Abort execution if EXPR does not evaluate to nonzero. @@ -51,13 +52,13 @@ ut_dbg_assertion_failed( #define ut_a(EXPR) do { \ if (UNIV_UNLIKELY(!(ulint) (EXPR))) { \ ut_dbg_assertion_failed(#EXPR, \ - __FILE__, (ulint) __LINE__); \ + __FILE__, __LINE__); \ } \ } while (0) /** Abort execution. */ #define ut_error \ - ut_dbg_assertion_failed(0, __FILE__, (ulint) __LINE__) + ut_dbg_assertion_failed(0, __FILE__, __LINE__) #ifdef UNIV_DEBUG /** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */ diff --git a/storage/innobase/include/ut0mem.ic b/storage/innobase/include/ut0mem.ic index 224ff98b0f4..df04449bcb9 100644 --- a/storage/innobase/include/ut0mem.ic +++ b/storage/innobase/include/ut0mem.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -118,15 +119,15 @@ ut_raw_to_hex( #define MK_UINT16(a, b) (((uint16) (a)) << 8 | (uint16) (b)) -#define UINT16_GET_A(u) ((unsigned char) ((u) >> 8)) -#define UINT16_GET_B(u) ((unsigned char) ((u) & 0xFF)) +#define UINT16_GET_A(u) ((char) ((u) >> 8)) +#define UINT16_GET_B(u) ((char) ((u) & 0xFF)) #else /* WORDS_BIGENDIAN */ #define MK_UINT16(a, b) (((uint16) (b)) << 8 | (uint16) (a)) -#define UINT16_GET_A(u) ((unsigned char) ((u) & 0xFF)) -#define UINT16_GET_B(u) ((unsigned char) ((u) >> 8)) +#define UINT16_GET_A(u) ((char) ((u) & 0xFF)) +#define UINT16_GET_B(u) ((char) ((u) >> 8)) #endif /* WORDS_BIGENDIAN */ diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h index 354fd9e0a7a..bd3603ad4d0 100644 --- a/storage/innobase/include/ut0mutex.h +++ b/storage/innobase/include/ut0mutex.h @@ -78,19 +78,22 @@ typedef BlockSyncArrayMutex ib_bpmutex_t; extern uint srv_spin_wait_delay; extern ulong srv_n_spin_wait_rounds; -#define mutex_create(I, M) mutex_init((M), (I), __FILE__, __LINE__) +#define mutex_create(I, M) mutex_init((M), (I), \ + __FILE__, __LINE__) -#define mutex_enter(M) (M)->enter( \ - srv_n_spin_wait_rounds, \ - srv_spin_wait_delay, \ - __FILE__, __LINE__) +#define mutex_enter_loc(M,file,line) (M)->enter( \ + uint32_t(srv_n_spin_wait_rounds), \ + uint32_t(srv_spin_wait_delay), \ + file, line) +#define mutex_enter(M) mutex_enter_loc(M, __FILE__, __LINE__) #define mutex_enter_nospin(M) (M)->enter( \ 0, \ 0, \ - __FILE__, __LINE__) + __FILE__, uint32_t(__LINE__)) -#define mutex_enter_nowait(M) (M)->trylock(__FILE__, __LINE__) +#define mutex_enter_nowait(M) (M)->trylock(__FILE__, \ + uint32_t(__LINE__)) #define mutex_exit(M) (M)->exit() diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake index 9cc6e434f38..880389edbf1 100644 --- a/storage/innobase/innodb.cmake +++ b/storage/innobase/innodb.cmake @@ -110,6 +110,17 @@ ENDIF() # Enable InnoDB's UNIV_DEBUG in debug builds SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG -DUNIV_SYNC_DEBUG") +OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON) +OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON) +IF(WITH_INNODB_AHI) + ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT -DBTR_CUR_ADAPT) + IF(NOT WITH_INNODB_ROOT_GUESS) + MESSAGE(WARNING "WITH_INNODB_AHI implies WITH_INNODB_ROOT_GUESS") + ENDIF() +ELSEIF(WITH_INNODB_ROOT_GUESS) + ADD_DEFINITIONS(-DBTR_CUR_ADAPT) +ENDIF() + OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF) IF(WITH_INNODB_EXTRA_DEBUG) IF(NOT WITH_DEBUG) @@ -117,7 +128,9 @@ IF(WITH_INNODB_EXTRA_DEBUG) ENDIF() SET(EXTRA_DEBUG_FLAGS "") - SET(EXTRA_DEBUG_FLAGS "${EXTRA_DEBUG_FLAGS} -DUNIV_AHI_DEBUG") + IF(WITH_INNODB_AHI) + SET(EXTRA_DEBUG_FLAGS "${EXTRA_DEBUG_FLAGS} -DUNIV_AHI_DEBUG") + ENDIF() SET(EXTRA_DEBUG_FLAGS "${EXTRA_DEBUG_FLAGS} -DUNIV_DDL_DEBUG") SET(EXTRA_DEBUG_FLAGS "${EXTRA_DEBUG_FLAGS} -DUNIV_DEBUG_FILE_ACCESSES") SET(EXTRA_DEBUG_FLAGS "${EXTRA_DEBUG_FLAGS} -DUNIV_ZIP_DEBUG") @@ -189,7 +202,6 @@ ENDIF() ENDIF(NOT MSVC) -CHECK_FUNCTION_EXISTS(asprintf HAVE_ASPRINTF) CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF) CHECK_CXX_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS) @@ -197,18 +209,6 @@ IF(HAVE_C99_INITIALIZERS) ADD_DEFINITIONS(-DHAVE_C99_INITIALIZERS) ENDIF() -IF(UNIX) -# this is needed to know which one of atomic_cas_32() or atomic_cas_64() -# to use in the source -SET(CMAKE_EXTRA_INCLUDE_FILES pthread.h) -CHECK_TYPE_SIZE(pthread_t SIZEOF_PTHREAD_T) -SET(CMAKE_EXTRA_INCLUDE_FILES) -ENDIF() - -IF(SIZEOF_PTHREAD_T) - ADD_DEFINITIONS(-DSIZEOF_PTHREAD_T=${SIZEOF_PTHREAD_T}) -ENDIF() - SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex") IF(MUTEXTYPE MATCHES "event") @@ -218,7 +218,7 @@ ELSEIF(MUTEXTYPE MATCHES "futex" AND DEFINED HAVE_IB_LINUX_FUTEX) ELSE() ADD_DEFINITIONS(-DMUTEX_SYS) ENDIF() - + # Include directories under innobase INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include ${CMAKE_SOURCE_DIR}/storage/innobase/handler) diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 3916bf9961f..11c1bedd39a 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, 2016, MariaDB Corporation +Copyright (c) 2014, 2017, 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 @@ -1109,7 +1109,7 @@ lock_rec_reset_nth_bit( ut_ad(i < lock->un_member.rec_lock.n_bits); byte* b = reinterpret_cast<byte*>(&lock[1]) + (i >> 3); - byte mask = 1 << (i & 7); + byte mask = static_cast<byte>(1U << (i & 7)); byte bit = *b & mask; *b &= ~mask; @@ -1717,7 +1717,7 @@ RecLock::lock_alloc( /* Setup the lock attributes */ - lock->type_mode = LOCK_REC | (mode & ~LOCK_TYPE_MASK); + lock->type_mode = uint32_t(LOCK_REC | (mode & ~LOCK_TYPE_MASK)); lock_rec_t& rec_lock = lock->un_member.rec_lock; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 99ae5799bb1..57796acf1af 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1515,7 +1515,6 @@ log_preflush_pool_modified_pages( bool success; if (recv_recovery_on) { - dberr_t err = DB_SUCCESS; /* If the recovery is running, we must first apply all log records to their respective file pages to get the right modify lsn values to these pages: otherwise, there @@ -1524,13 +1523,7 @@ log_preflush_pool_modified_pages( not know how up-to-date the disk version of the database is, and we could not make a new checkpoint on the basis of the info on the buffer pool only. */ - - err = recv_apply_hashed_log_recs(TRUE); - - if (err != DB_SUCCESS) { - ib::warn() << "recv_apply_hashed_log_recs failed err: " - << err << " file: " << __FILE__ << " line: " << __LINE__; - } + recv_apply_hashed_log_recs(true); } if (new_oldest == LSN_MAX @@ -1612,19 +1605,22 @@ log_io_complete_checkpoint(void) log_mutex_exit(); } -/******************************************************//** -Writes the checkpoint info to a log group header. */ +/** Write checkpoint info to the log header. +@param[in,out] group redo log +@param[in] end_lsn start LSN of the MLOG_CHECKPOINT mini-transaction */ static void -log_group_checkpoint( -/*=================*/ - log_group_t* group) /*!< in: log group */ +log_group_checkpoint(log_group_t* group, lsn_t end_lsn) { lsn_t lsn_offset; byte* buf; ut_ad(!srv_read_only_mode); ut_ad(log_mutex_own()); + ut_ad(end_lsn == 0 || end_lsn >= log_sys->next_checkpoint_lsn); + ut_ad(end_lsn <= log_sys->lsn); + ut_ad(end_lsn + SIZE_OF_MLOG_CHECKPOINT <= log_sys->lsn + || srv_shutdown_state != SRV_SHUTDOWN_NONE); DBUG_PRINT("ib_log", ("checkpoint " UINT64PF " at " LSN_PF " written to group " ULINTPF, @@ -1646,6 +1642,7 @@ log_group_checkpoint( group); mach_write_to_8(buf + LOG_CHECKPOINT_OFFSET, lsn_offset); mach_write_to_8(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size); + mach_write_to_8(buf + LOG_CHECKPOINT_END_LSN, end_lsn); log_block_set_checksum(buf, log_block_calc_checksum_crc32(buf)); @@ -1702,9 +1699,10 @@ log_group_header_read( } /** Write checkpoint info to the log header and invoke log_mutex_exit(). -@param[in] sync whether to wait for the write to complete */ +@param[in] sync whether to wait for the write to complete +@param[in] end_lsn start LSN of the MLOG_CHECKPOINT mini-transaction */ void -log_write_checkpoint_info(bool sync) +log_write_checkpoint_info(bool sync, lsn_t end_lsn) { ut_ad(log_mutex_own()); ut_ad(!srv_read_only_mode); @@ -1713,7 +1711,7 @@ log_write_checkpoint_info(bool sync) group; group = UT_LIST_GET_NEXT(log_groups, group)) { - log_group_checkpoint(group); + log_group_checkpoint(group, end_lsn); } log_mutex_exit(); @@ -1770,14 +1768,7 @@ log_checkpoint( os_thread_sleep(360000000);); if (recv_recovery_is_on()) { - dberr_t err = DB_SUCCESS; - - err = recv_apply_hashed_log_recs(TRUE); - - if (err != DB_SUCCESS) { - ib::warn() << "recv_apply_hashed_log_recs failed err: " - << err << " file: " << __FILE__ << " line: " << __LINE__; - } + recv_apply_hashed_log_recs(true); } #ifndef _WIN32 @@ -1827,12 +1818,13 @@ log_checkpoint( threads will be blocked, and no pages can be added to the flush lists. */ lsn_t flush_lsn = oldest_lsn; + const lsn_t end_lsn = log_sys->lsn; const bool do_write = srv_shutdown_state == SRV_SHUTDOWN_NONE - || flush_lsn != log_sys->lsn; + || flush_lsn != end_lsn; if (fil_names_clear(flush_lsn, do_write)) { - ut_ad(log_sys->lsn >= flush_lsn + SIZE_OF_MLOG_CHECKPOINT); + ut_ad(log_sys->lsn >= end_lsn + SIZE_OF_MLOG_CHECKPOINT); flush_lsn = log_sys->lsn; } @@ -1878,7 +1870,7 @@ log_checkpoint( } log_sys->next_checkpoint_lsn = oldest_lsn; - log_write_checkpoint_info(sync); + log_write_checkpoint_info(sync, end_lsn); ut_ad(!log_mutex_own()); return(true); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index f7c7c45240b..1ab1341bbdc 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2017, 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,7 +69,7 @@ this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */ #define RECV_READ_AHEAD_AREA 32 /** The recovery system */ -recv_sys_t* recv_sys = NULL; +recv_sys_t* recv_sys; /** TRUE when applying redo log records during crash recovery; FALSE otherwise. Note that this is FALSE while a background thread is rolling back incomplete transactions. */ @@ -98,9 +98,6 @@ buffer pool before the pages have been recovered to the up-to-date state. TRUE means that recovery is running and no operations on the log files are allowed yet: the variable name is misleading. */ bool recv_no_ibuf_operations; -/** The following counter is used to decide when to print info on -log scan */ -static ulint recv_scan_print_counter; /** The type of the previous parsed redo log record */ static mlog_id_t recv_previous_parsed_rec_type; @@ -138,16 +135,6 @@ const char* get_mlog_string(mlog_id_t type); #endif /* !DBUG_OFF */ -/* prototypes */ - -/*******************************************************//** -Initialize crash recovery environment. Can be called iff -recv_needed_recovery == false. */ -static -void -recv_init_crash_recovery(void); -/*===========================*/ - /** Tablespace item during recovery */ struct file_name_t { /** Tablespace file name (MLOG_FILE_NAME) */ @@ -526,7 +513,6 @@ recv_sys_var_init(void) recv_needed_recovery = false; recv_lsn_checks_on = false; recv_no_ibuf_operations = false; - recv_scan_print_counter = 0; recv_previous_parsed_rec_type = MLOG_SINGLE_REC_FLAG; recv_previous_parsed_rec_offset = 0; recv_previous_parsed_rec_is_multi = 0; @@ -632,6 +618,7 @@ recv_sys_init( recv_sys->found_corrupt_log = false; recv_sys->found_corrupt_fs = false; recv_sys->mlog_checkpoint_lsn = 0; + recv_sys->progress_time = ut_time(); recv_max_page_lsn = 0; @@ -641,19 +628,13 @@ recv_sys_init( mutex_exit(&(recv_sys->mutex)); } -/********************************************************//** -Empties the hash table when it has been fully processed.*/ +/** Empty a fully processed hash table. */ static void -recv_sys_empty_hash(void) -/*=====================*/ +recv_sys_empty_hash() { ut_ad(mutex_own(&(recv_sys->mutex))); - - if (recv_sys->n_addrs != 0) { - ib::fatal() << recv_sys->n_addrs << " pages with log records" - " were left unprocessed!"; - } + ut_a(recv_sys->n_addrs == 0); hash_table_free(recv_sys->addr_hash); mem_heap_empty(recv_sys->heap); @@ -750,7 +731,8 @@ loop: happen when InnoDB was killed while it was writing redo log. We simply treat this as an abrupt end of the redo log. */ - return(start_lsn); + end_lsn = start_lsn; + break; } if (innodb_log_checksums || group->is_encrypted()) { @@ -764,7 +746,8 @@ loop: << log_block_get_checkpoint_no(buf) << " expected: " << crc << " found: " << cksum; - return(start_lsn); + end_lsn = start_lsn; + break; } if (group->is_encrypted()) { @@ -773,8 +756,13 @@ loop: } } - if (start_lsn != end_lsn) { + if (recv_sys->report(ut_time())) { + ib::info() << "Read redo log up to LSN=" << start_lsn; + sd_notifyf(0, "STATUS=Read redo log up to LSN=" LSN_PF, + start_lsn); + } + if (start_lsn != end_lsn) { goto loop; } @@ -818,7 +806,7 @@ recv_synchronize_groups() checkpoint info on disk certain */ if (!srv_read_only_mode) { - log_write_checkpoint_info(true); + log_write_checkpoint_info(true, 0); log_mutex_enter(); } } @@ -1042,14 +1030,17 @@ recv_find_max_checkpoint( log_group_header_read(group, field); - if (!recv_check_log_header_checksum(buf)) { + const ulint crc32 = log_block_calc_checksum_crc32(buf); + const ulint cksum = log_block_get_checksum(buf); + + if (crc32 != cksum) { DBUG_PRINT("ib_log", ("invalid checkpoint," " group " ULINTPF " at " ULINTPF - ", checksum %x", + ", checksum %x expected %x", group->id, field, - (unsigned) log_block_get_checksum( - buf))); + (unsigned) cksum, + (unsigned) crc32)); continue; } @@ -1167,12 +1158,24 @@ recv_parse_or_apply_log_rec_body( } else if (apply && !is_predefined_tablespace(space_id) && recv_spaces.find(space_id) == recv_spaces.end()) { - ib::fatal() << "Missing MLOG_FILE_NAME or MLOG_FILE_DELETE" + if (recv_sys->recovered_lsn < recv_sys->mlog_checkpoint_lsn) { + /* We have not seen all records between the + checkpoint and MLOG_CHECKPOINT. There should be + a MLOG_FILE_DELETE for this tablespace later. */ + recv_spaces.insert( + std::make_pair(space_id, + file_name_t("", false))); + goto parse_log; + } + + ib::error() << "Missing MLOG_FILE_NAME or MLOG_FILE_DELETE" " for redo log record " << type << " (page " - << space_id << ":" << page_no << ") at " - << recv_sys->recovered_lsn << "."; + << space_id << ":" << page_no << ") at " + << recv_sys->recovered_lsn << "."; + recv_sys->found_corrupt_log = true; return(NULL); } else { +parse_log: /* Parsing a page log record. */ page = NULL; page_zip = NULL; @@ -1326,17 +1329,6 @@ recv_parse_or_apply_log_rec_body( ptr, end_ptr, page, page_zip, index); } break; - case MLOG_COMP_REC_SEC_DELETE_MARK: - ut_ad(!page || fil_page_type_is_index(page_type)); - /* This log record type is obsolete, but we process it for - backward compatibility with MySQL 5.0.3 and 5.0.4. */ - ut_a(!page || page_is_comp(page)); - ut_a(!page_zip); - ptr = mlog_parse_index(ptr, end_ptr, TRUE, &index); - if (!ptr) { - break; - } - /* Fall through */ case MLOG_REC_SEC_DELETE_MARK: ut_ad(!page || fil_page_type_is_index(page_type)); ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr, @@ -1917,6 +1909,8 @@ recv_recover_page(bool just_read_in, buf_block_t* block) mtr_commit(&mtr); + ib_time_t time = ut_time(); + mutex_enter(&(recv_sys->mutex)); if (recv_max_page_lsn < page_lsn) { @@ -1925,11 +1919,16 @@ recv_recover_page(bool just_read_in, buf_block_t* block) recv_addr->state = RECV_PROCESSED; - ut_a(recv_sys->n_addrs); - recv_sys->n_addrs--; - - mutex_exit(&(recv_sys->mutex)); + ut_a(recv_sys->n_addrs > 0); + if (ulint n = --recv_sys->n_addrs) { + if (recv_sys->report(time)) { + ib::info() << "To recover: " << n << " pages from log"; + sd_notifyf(0, "STATUS=To recover: " ULINTPF + " pages from log", n); + } + } + mutex_exit(&recv_sys->mutex); } /** Reads in pages which have hashed log records, from an area around a given @@ -1976,61 +1975,48 @@ recv_read_in_area( } buf_read_recv_pages(FALSE, page_id.space(), page_nos, n); - /* - fprintf(stderr, "Recv pages at %lu n %lu\n", page_nos[0], n); - */ return(n); } -/*******************************************************************//** -Empties the hash table of stored log records, applying them to appropriate -pages. -@return DB_SUCCESS when successfull or DB_ERROR when fails. */ -dberr_t -recv_apply_hashed_log_recs( -/*=======================*/ - ibool allow_ibuf) /*!< in: if TRUE, also ibuf operations are - allowed during the application; if FALSE, - no ibuf operations are allowed, and after - the application all file pages are flushed to - disk and invalidated in buffer pool: this - alternative means that no new log records - can be generated during the application; - the caller must in this case own the log - mutex */ +/** Apply the hash table of stored log records to persistent data pages. +@param[in] last_batch whether the change buffer merge will be + performed as part of the operation */ +void +recv_apply_hashed_log_recs(bool last_batch) { - recv_addr_t* recv_addr; - ulint i; - ibool has_printed = FALSE; - mtr_t mtr; - ulint progress = 0; - dberr_t err = DB_SUCCESS; -loop: - mutex_enter(&(recv_sys->mutex)); - - if (recv_sys->apply_batch_on) { + for (;;) { + mutex_enter(&recv_sys->mutex); - mutex_exit(&(recv_sys->mutex)); + if (!recv_sys->apply_batch_on) { + break; + } + mutex_exit(&recv_sys->mutex); os_thread_sleep(500000); - - goto loop; } - ut_ad(!allow_ibuf == log_mutex_own()); + ut_ad(!last_batch == log_mutex_own()); - if (!allow_ibuf) { + if (!last_batch) { recv_no_ibuf_operations = true; } + if (ulint n = recv_sys->n_addrs) { + const char* msg = last_batch + ? "Starting final batch to recover " + : "Starting a batch to recover "; + ib::info() << msg << n << " pages from redo log."; + sd_notifyf(0, "STATUS=%s" ULINTPF " pages from redo log", + msg, n); + } recv_sys->apply_log_recs = TRUE; recv_sys->apply_batch_on = TRUE; - for (i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) { + for (ulint i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) { - for (recv_addr = static_cast<recv_addr_t*>( + for (recv_addr_t* recv_addr = static_cast<recv_addr_t*>( HASH_GET_FIRST(recv_sys->addr_hash, i)); - recv_addr != 0; + recv_addr; recv_addr = static_cast<recv_addr_t*>( HASH_GET_NEXT(addr_hash, recv_addr))) { @@ -2059,23 +2045,13 @@ loop: ut_ad(found); if (recv_addr->state == RECV_NOT_PROCESSED) { - if (!has_printed) { - ib::info() << "Starting an apply batch" - " of log records" - " to the database..."; - fputs("InnoDB: Progress in percent: ", - stderr); - has_printed = TRUE; - } - - mutex_exit(&(recv_sys->mutex)); + mutex_exit(&recv_sys->mutex); if (buf_page_peek(page_id)) { - buf_block_t* block; - - mtr_start(&mtr); + mtr_t mtr; + mtr.start(); - block = buf_page_get( + buf_block_t* block = buf_page_get( page_id, page_size, RW_X_LATCH, &mtr); @@ -2083,7 +2059,7 @@ loop: block, SYNC_NO_ORDER_CHECK); recv_recover_page(FALSE, block); - mtr_commit(&mtr); + mtr.commit(); } else { recv_read_in_area(page_id); } @@ -2091,19 +2067,6 @@ loop: mutex_enter(&(recv_sys->mutex)); } } - - progress = (ulint) ((i * 100) / hash_get_n_cells(recv_sys->addr_hash)); - - if (has_printed - && progress - && (i * 100) / hash_get_n_cells(recv_sys->addr_hash) - != ((i + 1) * 100) - / hash_get_n_cells(recv_sys->addr_hash)) { - - fprintf(stderr, "%lu ", progress); - sd_notifyf(0, "STATUS=Applying batch of log records for" - " InnoDB: Progress %lu", progress); - } } /* Wait until all the pages have been processed */ @@ -2117,13 +2080,7 @@ loop: mutex_enter(&(recv_sys->mutex)); } - if (has_printed) { - - fprintf(stderr, "\n"); - } - - if (!allow_ibuf) { - + if (!last_batch) { /* Flush all the file pages to disk and invalidate them in the buffer pool */ @@ -2160,14 +2117,7 @@ loop: recv_sys_empty_hash(); - if (has_printed) { - ib::info() << "Apply batch completed"; - sd_notify(0, "STATUS=InnoDB: Apply batch completed"); - } - - mutex_exit(&(recv_sys->mutex)); - - return err; + mutex_exit(&recv_sys->mutex); } /** Tries to parse a single log record. @@ -2485,15 +2435,6 @@ loop: return(true); } break; - case MLOG_FILE_NAME: - case MLOG_FILE_DELETE: - case MLOG_FILE_CREATE2: - case MLOG_FILE_RENAME2: - case MLOG_TRUNCATE: - /* These were already handled by - recv_parse_log_rec() and - recv_parse_or_apply_log_rec_body(). */ - break; #ifdef UNIV_LOG_LSN_DEBUG case MLOG_LSN: /* Do not add these records to the hash table. @@ -2518,6 +2459,14 @@ loop: recv_sys->recovered_lsn); } /* fall through */ + case MLOG_FILE_NAME: + case MLOG_FILE_DELETE: + case MLOG_FILE_CREATE2: + case MLOG_FILE_RENAME2: + case MLOG_TRUNCATE: + /* These were already handled by + recv_parse_log_rec() and + recv_parse_or_apply_log_rec_body(). */ case MLOG_INDEX_LOAD: DBUG_PRINT("ib_log", ("scan " LSN_PF ": log rec %s" @@ -2845,25 +2794,18 @@ recv_scan_log_recs( scanned_lsn += data_len; if (scanned_lsn > recv_sys->scanned_lsn) { - - /* We have found more entries. If this scan is - of startup type, we must initiate crash recovery - environment before parsing these log records. */ - if (!recv_needed_recovery) { + recv_needed_recovery = true; - if (!srv_read_only_mode) { - ib::info() << "Log scan progressed" - " past the checkpoint lsn " - << recv_sys->scanned_lsn; - - recv_init_crash_recovery(); - } else { + if (srv_read_only_mode) { ib::warn() << "innodb_read_only" " prevents crash recovery"; - recv_needed_recovery = true; return(true); } + + ib::info() << "Starting crash recovery from" + " checkpoint LSN=" + << recv_sys->scanned_lsn; } /* We were able to find more log data: add it to the @@ -2904,16 +2846,6 @@ recv_scan_log_recs( *group_scanned_lsn = scanned_lsn; - if (recv_needed_recovery) { - recv_scan_print_counter++; - - if (finished || (recv_scan_print_counter % 80 == 0)) { - - ib::info() << "Doing recovery: scanned up to" - " log sequence number " << scanned_lsn; - } - } - if (more_data && !recv_sys->found_corrupt_log) { /* Try to parse more log records */ @@ -2944,6 +2876,7 @@ recv_scan_log_recs( /** Scans log from a buffer and stores new log data to the parsing buffer. Parses and hashes the log records if new data found. @param[in,out] group log group +@param[in] checkpoint_lsn latest checkpoint log sequence number @param[in,out] contiguous_lsn log sequence number until which all redo log has been scanned @param[in] last_phase whether changes @@ -2953,6 +2886,7 @@ static bool recv_group_scan_log_recs( log_group_t* group, + lsn_t checkpoint_lsn, lsn_t* contiguous_lsn, bool last_phase) { @@ -2976,7 +2910,6 @@ recv_group_scan_log_recs( ut_ad(last_phase || !recv_writer_thread_active); mutex_exit(&recv_sys->mutex); - lsn_t checkpoint_lsn = *contiguous_lsn; lsn_t start_lsn; lsn_t end_lsn; store_t store_to_hash = recv_sys->mlog_checkpoint_lsn == 0 @@ -2995,9 +2928,7 @@ recv_group_scan_log_recs( merge here, because it would generate redo log records before we have finished the redo log scan. */ - if (recv_apply_hashed_log_recs(FALSE) != DB_SUCCESS) { - DBUG_RETURN(false); - } + recv_apply_hashed_log_recs(false); } start_lsn = end_lsn; @@ -3023,19 +2954,6 @@ recv_group_scan_log_recs( DBUG_RETURN(store_to_hash == STORE_NO); } -/*******************************************************//** -Initialize crash recovery environment. Can be called iff -recv_needed_recovery == false. */ -static -void -recv_init_crash_recovery(void) -{ - ut_ad(!srv_read_only_mode); - ut_a(!recv_needed_recovery); - - recv_needed_recovery = true; -} - /** Report a missing tablespace for which page-redo log exists. @param[in] err previous error code @param[in] i tablespace descriptor @@ -3077,12 +2995,10 @@ recv_init_crash_recovery_spaces(void) ut_ad(!srv_read_only_mode); ut_ad(recv_needed_recovery); - ib::info() << "Database was not shutdown normally!"; - ib::info() << "Starting crash recovery."; - for (recv_spaces_t::iterator i = recv_spaces.begin(); i != recv_spaces.end(); i++) { ut_ad(!is_predefined_tablespace(i->first)); + ut_ad(!i->second.deleted || !i->second.space); if (i->second.deleted) { /* The tablespace was deleted, @@ -3092,10 +3008,19 @@ recv_init_crash_recovery_spaces(void) /* The tablespace was found, and there are some redo log records for it. */ fil_names_dirty(i->second.space); + } else if (i->second.name == "") { + ib::error() << "Missing MLOG_FILE_NAME" + " or MLOG_FILE_DELETE" + " before MLOG_CHECKPOINT for tablespace " + << i->first; + recv_sys->found_corrupt_log = true; + return(DB_CORRUPTION); } else { missing_spaces.insert(i->first); flag_deleted = true; } + + ut_ad(i->second.deleted || i->second.name != ""); } if (flag_deleted) { @@ -3208,9 +3133,7 @@ recv_recovery_from_checkpoint_start( err = recv_find_max_checkpoint(&max_cp_group, &max_cp_field); if (err != DB_SUCCESS) { - log_mutex_exit(); - return(err); } @@ -3231,6 +3154,8 @@ recv_recovery_from_checkpoint_start( ut_ad(UT_LIST_GET_LEN(log_sys->log_groups) == 1); group = UT_LIST_GET_FIRST(log_sys->log_groups); + const lsn_t end_lsn = mach_read_from_8( + buf + LOG_CHECKPOINT_END_LSN); ut_ad(recv_sys->n_addrs == 0); contiguous_lsn = checkpoint_lsn; @@ -3240,16 +3165,23 @@ recv_recovery_from_checkpoint_start( return(recv_log_format_0_recover(checkpoint_lsn)); case LOG_HEADER_FORMAT_CURRENT: case LOG_HEADER_FORMAT_CURRENT | LOG_HEADER_FORMAT_ENCRYPTED: - break; + if (end_lsn == 0) { + break; + } + if (end_lsn >= checkpoint_lsn) { + contiguous_lsn = end_lsn; + break; + } + /* fall through */ default: - ut_ad(0); recv_sys->found_corrupt_log = true; log_mutex_exit(); return(DB_ERROR); } /* Look for MLOG_CHECKPOINT. */ - recv_group_scan_log_recs(group, &contiguous_lsn, false); + recv_group_scan_log_recs(group, checkpoint_lsn, &contiguous_lsn, + false); /* The first scan should not have stored or applied any records. */ ut_ad(recv_sys->n_addrs == 0); ut_ad(!recv_sys->found_corrupt_fs); @@ -3266,13 +3198,16 @@ recv_recovery_from_checkpoint_start( } if (recv_sys->mlog_checkpoint_lsn == 0) { - if (!srv_read_only_mode - && group->scanned_lsn != checkpoint_lsn) { - ib::error() << "Missing" - " MLOG_CHECKPOINT between the checkpoint " - << checkpoint_lsn << " and the end " - << group->scanned_lsn << "."; + lsn_t scan_lsn = group->scanned_lsn; + if (!srv_read_only_mode && scan_lsn != checkpoint_lsn) { log_mutex_exit(); + ib::error err; + err << "Missing MLOG_CHECKPOINT"; + if (end_lsn) { + err << " at " << end_lsn; + } + err << " between the checkpoint " << checkpoint_lsn + << " and the end " << scan_lsn << "."; return(DB_ERROR); } @@ -3281,7 +3216,7 @@ recv_recovery_from_checkpoint_start( } else { contiguous_lsn = checkpoint_lsn; rescan = recv_group_scan_log_recs( - group, &contiguous_lsn, false); + group, checkpoint_lsn, &contiguous_lsn, false); if ((recv_sys->found_corrupt_log && !srv_force_recovery) || recv_sys->found_corrupt_fs) { @@ -3313,13 +3248,13 @@ recv_recovery_from_checkpoint_start( << " in the ib_logfiles!"; if (srv_read_only_mode) { - ib::error() << "Can't initiate database" - " recovery, running in read-only-mode."; + ib::error() << "innodb_read_only" + " prevents crash recovery"; log_mutex_exit(); return(DB_READ_ONLY); } - recv_init_crash_recovery(); + recv_needed_recovery = true; } } @@ -3336,7 +3271,8 @@ recv_recovery_from_checkpoint_start( if (rescan) { contiguous_lsn = checkpoint_lsn; - recv_group_scan_log_recs(group, &contiguous_lsn, true); + recv_group_scan_log_recs(group, checkpoint_lsn, + &contiguous_lsn, true); if ((recv_sys->found_corrupt_log && !srv_force_recovery) @@ -3367,11 +3303,6 @@ recv_recovery_from_checkpoint_start( ib::error() << "Recovered only to lsn:" << recv_sys->recovered_lsn << " checkpoint_lsn: " << checkpoint_lsn; - /* No harm in trying to do RO access. */ - if (!srv_read_only_mode) { - ut_error; - } - return(DB_ERROR); } @@ -3694,9 +3625,6 @@ get_mlog_string(mlog_id_t type) case MLOG_COMP_REC_CLUST_DELETE_MARK: return("MLOG_COMP_REC_CLUST_DELETE_MARK"); - case MLOG_COMP_REC_SEC_DELETE_MARK: - return("MLOG_COMP_REC_SEC_DELETE_MARK"); - case MLOG_COMP_REC_UPDATE_IN_PLACE: return("MLOG_COMP_REC_UPDATE_IN_PLACE"); diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc index ff793821895..d067bbaa803 100644 --- a/storage/innobase/mem/mem0mem.cc +++ b/storage/innobase/mem/mem0mem.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2014, 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 the terms of the GNU General Public License as published by the Free Software @@ -272,7 +273,7 @@ mem_heap_create_block_func( ulint n, /*!< in: number of bytes needed for user data */ #ifdef UNIV_DEBUG const char* file_name,/*!< in: file name where created */ - ulint line, /*!< in: line where created */ + unsigned line, /*!< in: line where created */ #endif /* UNIV_DEBUG */ ulint type) /*!< in: type of heap: MEM_HEAP_DYNAMIC or MEM_HEAP_BUFFER */ diff --git a/storage/innobase/mtr/mtr0log.cc b/storage/innobase/mtr/mtr0log.cc index a63ad40a3b0..783fdcd05ac 100644 --- a/storage/innobase/mtr/mtr0log.cc +++ b/storage/innobase/mtr/mtr0log.cc @@ -101,7 +101,7 @@ mlog_parse_initial_log_record( return(NULL); } - *type = (mlog_id_t)((ulint)*ptr & ~MLOG_SINGLE_REC_FLAG); + *type = mlog_id_t(*ptr & ~MLOG_SINGLE_REC_FLAG); ut_ad(*type <= MLOG_BIGGEST_TYPE || EXTRA_CHECK_MLOG_NUMBER(*type)); ptr++; diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 418cd7042c6..c19d2131d1e 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -124,11 +124,11 @@ struct FindPage /* There must be some flags to look for. */ ut_ad(flags); /* We can only look for page-related flags. */ - ut_ad(!(flags & ~(MTR_MEMO_PAGE_S_FIX - | MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_SX_FIX - | MTR_MEMO_BUF_FIX - | MTR_MEMO_MODIFY))); + ut_ad(!(flags & ulint(~(MTR_MEMO_PAGE_S_FIX + | MTR_MEMO_PAGE_X_FIX + | MTR_MEMO_PAGE_SX_FIX + | MTR_MEMO_BUF_FIX + | MTR_MEMO_MODIFY)))); } /** Visit a memo entry. @@ -680,7 +680,7 @@ NOTE: use mtr_x_lock_space(). @param[in] line line number in file @return the tablespace object (never NULL) */ fil_space_t* -mtr_t::x_lock_space(ulint space_id, const char* file, ulint line) +mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line) { fil_space_t* space; @@ -1053,14 +1053,14 @@ struct FlaggedCheck { /* There must be some flags to look for. */ ut_ad(flags); /* Look for rw-lock-related and page-related flags. */ - ut_ad(!(flags & ~(MTR_MEMO_PAGE_S_FIX - | MTR_MEMO_PAGE_X_FIX - | MTR_MEMO_PAGE_SX_FIX - | MTR_MEMO_BUF_FIX - | MTR_MEMO_MODIFY - | MTR_MEMO_X_LOCK - | MTR_MEMO_SX_LOCK - | MTR_MEMO_S_LOCK))); + ut_ad(!(flags & ulint(~(MTR_MEMO_PAGE_S_FIX + | MTR_MEMO_PAGE_X_FIX + | MTR_MEMO_PAGE_SX_FIX + | MTR_MEMO_BUF_FIX + | MTR_MEMO_MODIFY + | MTR_MEMO_X_LOCK + | MTR_MEMO_SX_LOCK + | MTR_MEMO_S_LOCK)))); /* Either some rw-lock-related or page-related flags must be specified, but not both at the same time. */ ut_ad(!(flags & (MTR_MEMO_PAGE_S_FIX diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 270bfa2887e..f71602c43b9 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -73,11 +73,6 @@ Created 10/21/1995 Heikki Tuuri # include <linux/falloc.h> #endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */ -#ifdef UNIV_DEBUG -/** Set when InnoDB has invoked exit(). */ -bool innodb_calling_exit; -#endif /* UNIV_DEBUG */ - #if defined(UNIV_LINUX) && defined(HAVE_SYS_IOCTL_H) # include <sys/ioctl.h> # ifndef DFS_IOCTL_ATOMIC_WRITE_SET @@ -371,7 +366,7 @@ public: void print(FILE* file); /** @return the number of slots per segment */ - ulint slots_per_segment() const + unsigned slots_per_segment() const MY_ATTRIBUTE((warn_unused_result)) { return(m_slots.size() / m_n_segments); @@ -442,7 +437,7 @@ public: @param[in] max_events number of events @param[out] io_ctx io_ctx to initialize. @return true on success. */ - static bool linux_create_io_ctx(ulint max_events, io_context_t* io_ctx) + static bool linux_create_io_ctx(unsigned max_events, io_context_t* io_ctx) MY_ATTRIBUTE((warn_unused_result)); /** Checks if the system supports native linux aio. On some kernel @@ -2134,7 +2129,7 @@ AIO::linux_dispatch(Slot* slot) @return true on success. */ bool AIO::linux_create_io_ctx( - ulint max_events, + unsigned max_events, io_context_t* io_ctx) { ssize_t n_retries = 0; @@ -2912,8 +2907,8 @@ os_file_create_func( on_error_silent = create_mode & OS_FILE_ON_ERROR_SILENT ? true : false; - create_mode &= ~OS_FILE_ON_ERROR_NO_EXIT; - create_mode &= ~OS_FILE_ON_ERROR_SILENT; + create_mode &= ulint(~(OS_FILE_ON_ERROR_NO_EXIT + | OS_FILE_ON_ERROR_SILENT)); if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW @@ -5764,7 +5759,7 @@ AIO::init_linux_native_aio() } io_context** ctx = m_aio_ctx; - ulint max_events = slots_per_segment(); + unsigned max_events = slots_per_segment(); for (ulint i = 0; i < m_n_segments; ++i, ++ctx) { diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index b32e8deb6e6..16bdf602e81 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -40,11 +40,6 @@ Created 10/4/1994 Heikki Tuuri #include <algorithm> -#ifdef PAGE_CUR_ADAPT -# ifdef UNIV_SEARCH_PERF_STAT -static ulint page_cur_short_succ = 0; -# endif /* UNIV_SEARCH_PERF_STAT */ - /*******************************************************************//** This is a linear congruential generator PRNG. Returns a pseudo random number between 0 and 2^64-1 inclusive. The formula and the constants @@ -79,6 +74,11 @@ page_cur_lcg_prng(void) return(lcg_current); } +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_SEARCH_PERF_STAT +static ulint page_cur_short_succ; +# endif /* UNIV_SEARCH_PERF_STAT */ + /** Try a search shortcut based on the last insert. @param[in] block index page @param[in] index index tree @@ -246,7 +246,7 @@ exit_func: } return(success); } -#endif +#endif /* BTR_CUR_HASH_ADAPT */ #ifdef PAGE_CUR_LE_OR_EXTENDS /****************************************************************//** @@ -359,7 +359,7 @@ page_cur_search_with_match( ut_d(page_check_dir(page)); -#ifdef PAGE_CUR_ADAPT +#ifdef BTR_CUR_HASH_ADAPT if (page_is_leaf(page) && (mode == PAGE_CUR_LE) && !dict_index_is_spatial(index) @@ -380,7 +380,7 @@ page_cur_search_with_match( mode = PAGE_CUR_LE; } # endif -#endif +#endif /* BTR_CUR_HASH_ADAPT */ /* If the mode is for R-tree indexes, use the special MBR related compare functions */ @@ -552,6 +552,7 @@ up_rec_match: } } +#ifdef BTR_CUR_HASH_ADAPT /** Search the right position for a page cursor. @param[in] block buffer block @param[in] index index tree @@ -619,7 +620,7 @@ page_cur_search_with_match_bytes( ut_d(page_check_dir(page)); -#ifdef PAGE_CUR_ADAPT +#ifdef BTR_CUR_HASH_ADAPT if (page_is_leaf(page) && (mode == PAGE_CUR_LE) && (page_header_get_field(page, PAGE_N_DIRECTION) > 3) @@ -639,7 +640,7 @@ page_cur_search_with_match_bytes( mode = PAGE_CUR_LE; } # endif -#endif +#endif /* BTR_CUR_HASH_ADAPT */ /* The following flag does not work for non-latin1 char sets because cmp_full_field does not tell how many bytes matched */ @@ -805,6 +806,7 @@ up_rec_match: mem_heap_free(heap); } } +#endif /* BTR_CUR_HASH_ADAPT */ /***********************************************************//** Positions a page cursor on a randomly chosen user record on a page. If there diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index e2d2dd40fd8..d38b426b0d4 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -2,6 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. +Copyright (c) 2017, 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 @@ -1162,8 +1163,7 @@ delete_all: if (scrub) { /* scrub record */ - uint recsize = rec_offs_data_size(offsets); - memset(rec2, 0, recsize); + memset(rec2, 0, rec_offs_data_size(offsets)); } rec2 = page_rec_get_next(rec2); diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index d49cecdb968..c0746bd9d5f 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -2,6 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. +Copyright (c) 2017, 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 @@ -1595,9 +1596,9 @@ err_exit: #ifdef UNIV_DEBUG page_zip->m_start = #endif /* UNIV_DEBUG */ - page_zip->m_end = PAGE_DATA + c_stream.total_out; + page_zip->m_end = unsigned(PAGE_DATA + c_stream.total_out); page_zip->m_nonempty = FALSE; - page_zip->n_blobs = n_blobs; + page_zip->n_blobs = unsigned(n_blobs); /* Copy those header fields that will not be written in buf_flush_init_for_writing() */ memcpy(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV, @@ -1714,7 +1715,7 @@ page_zip_fields_decode( index = dict_mem_index_create("ZIP_DUMMY", "ZIP_DUMMY", DICT_HDR_SPACE, 0, n); index->table = table; - index->n_uniq = n; + index->n_uniq = unsigned(n); /* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */ index->cached = TRUE; @@ -1773,7 +1774,7 @@ page_zip_fields_decode( page_zip_fields_free(index); index = NULL; } else { - index->n_nullable = val; + index->n_nullable = unsigned(val); } } @@ -2429,7 +2430,7 @@ zlib_done: } #ifdef UNIV_DEBUG - page_zip->m_start = PAGE_DATA + d_stream->total_in; + page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in); #endif /* UNIV_DEBUG */ /* Apply the modification log. */ @@ -2444,7 +2445,7 @@ zlib_done: if (UNIV_UNLIKELY(!mod_log_ptr)) { return(FALSE); } - page_zip->m_end = mod_log_ptr - page_zip->data; + page_zip->m_end = unsigned(mod_log_ptr - page_zip->data); page_zip->m_nonempty = mod_log_ptr != d_stream->next_in; } @@ -2582,9 +2583,7 @@ zlib_done: - d_stream->next_out); } -#ifdef UNIV_DEBUG - page_zip->m_start = PAGE_DATA + d_stream->total_in; -#endif /* UNIV_DEBUG */ + ut_d(page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in)); /* Apply the modification log. */ { @@ -2598,7 +2597,7 @@ zlib_done: if (UNIV_UNLIKELY(!mod_log_ptr)) { return(FALSE); } - page_zip->m_end = mod_log_ptr - page_zip->data; + page_zip->m_end = unsigned(mod_log_ptr - page_zip->data); page_zip->m_nonempty = mod_log_ptr != d_stream->next_in; } @@ -2913,9 +2912,7 @@ zlib_done: - d_stream->next_out); } -#ifdef UNIV_DEBUG - page_zip->m_start = PAGE_DATA + d_stream->total_in; -#endif /* UNIV_DEBUG */ + ut_d(page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in)); /* Apply the modification log. */ { @@ -2929,7 +2926,7 @@ zlib_done: if (UNIV_UNLIKELY(!mod_log_ptr)) { return(FALSE); } - page_zip->m_end = mod_log_ptr - page_zip->data; + page_zip->m_end = unsigned(mod_log_ptr - page_zip->data); page_zip->m_nonempty = mod_log_ptr != d_stream->next_in; } @@ -3132,7 +3129,7 @@ zlib_error: d_stream.avail_in = static_cast<uInt>( page_zip_get_size(page_zip) - (PAGE_DATA + 1)); d_stream.next_out = page + PAGE_ZIP_START; - d_stream.avail_out = UNIV_PAGE_SIZE - PAGE_ZIP_START; + d_stream.avail_out = uInt(UNIV_PAGE_SIZE - PAGE_ZIP_START); if (UNIV_UNLIKELY(inflateInit2(&d_stream, UNIV_PAGE_SIZE_SHIFT) != Z_OK)) { @@ -3853,7 +3850,7 @@ page_zip_write_rec( ut_a(!*data); ut_ad((ulint) (data - page_zip->data) < page_zip_get_size(page_zip)); - page_zip->m_end = data - page_zip->data; + page_zip->m_end = unsigned(data - page_zip->data); page_zip->m_nonempty = TRUE; #ifdef UNIV_ZIP_DEBUG @@ -4919,7 +4916,7 @@ page_zip_calc_checksum( srv_checksum_algorithm_t algo, bool use_legacy_big_endian /* = false */) { - uint32_t adler; + uLong adler; const Bytef* s = static_cast<const byte*>(data); /* Exclude FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_LSN, @@ -4959,7 +4956,7 @@ page_zip_calc_checksum( static_cast<uInt>(size) - FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - return(adler); + return(uint32_t(adler)); case SRV_CHECKSUM_ALGORITHM_NONE: case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: return(BUF_NO_CHECKSUM_MAGIC); diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index 920fdb62079..d79b25a35a7 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) 2017, 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 @@ -549,7 +550,7 @@ rec_get_offsets_func( (ULINT_UNDEFINED if all fields) */ #ifdef UNIV_DEBUG const char* file, /*!< in: file name where called */ - ulint line, /*!< in: line number where called */ + unsigned line, /*!< in: line number where called */ #endif /* UNIV_DEBUG */ mem_heap_t** heap) /*!< in/out: memory heap */ { diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 1f884017dd3..db8a91ed21e 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) 2016, MariaDB Corporation. +Copyright (c) 2016, 2017, 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 @@ -2836,7 +2836,7 @@ row_ins_sec_index_entry_low( rtr_info_update_btr(&cursor, &rtr_info); mtr_start(&mtr); mtr.set_named_space(index->space); - search_mode &= ~BTR_MODIFY_LEAF; + search_mode &= ulint(~BTR_MODIFY_LEAF); search_mode |= BTR_MODIFY_TREE; err = btr_cur_search_to_nth_level( index, 0, entry, PAGE_CUR_RTREE_INSERT, @@ -3086,7 +3086,7 @@ row_ins_index_entry_big_rec_func( #ifndef DBUG_OFF const void* thd, /*!< in: connection, or NULL */ #endif /* DBUG_OFF */ - ulint line) /*!< in: line number of caller */ + unsigned line) /*!< in: line number of caller */ { mtr_t mtr; btr_pcur_t pcur; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 8fc7ecf75ac..ef832c38b95 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -4511,7 +4511,7 @@ row_merge_create_index( /*********************************************************************//** Check if a transaction can use an index. */ -ibool +bool row_merge_is_index_usable( /*======================*/ const trx_t* trx, /*!< in: transaction */ @@ -4520,7 +4520,7 @@ row_merge_is_index_usable( if (!dict_index_is_clust(index) && dict_index_is_online_ddl(index)) { /* Indexes that are being created are not useable. */ - return(FALSE); + return(false); } return(!dict_index_is_corrupted(index) diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index fbf49d8d3a0..ab5736f88d7 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2344,7 +2344,7 @@ row_mysql_freeze_data_dictionary_func( /*==================================*/ trx_t* trx, /*!< in/out: transaction */ const char* file, /*!< in: file name */ - ulint line) /*!< in: line number */ + unsigned line) /*!< in: line number */ { ut_a(trx->dict_operation_lock_mode == 0); @@ -2377,7 +2377,7 @@ row_mysql_lock_data_dictionary_func( /*================================*/ trx_t* trx, /*!< in/out: transaction */ const char* file, /*!< in: file name */ - ulint line) /*!< in: line number */ + unsigned line) /*!< in: line number */ { ut_a(trx->dict_operation_lock_mode == 0 || trx->dict_operation_lock_mode == RW_X_LATCH); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 4cd7a443d79..e3d61531728 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1456,6 +1456,7 @@ plan_reset_cursor( plan->n_rows_prefetched = 0; } +#ifdef BTR_CUR_HASH_ADAPT /*********************************************************************//** Tries to do a shortcut to fetch a clustered index record with a unique key, using the hash index if possible (not always). @@ -1485,11 +1486,8 @@ row_sel_try_search_shortcut( ut_ad(node->read_view); ut_ad(plan->unique_search); ut_ad(!plan->must_get_clust); -#ifdef UNIV_DEBUG - if (search_latch_locked) { - ut_ad(rw_lock_own(btr_get_search_latch(index), RW_LOCK_S)); - } -#endif /* UNIV_DEBUG */ + ut_ad(!search_latch_locked + || rw_lock_own(btr_get_search_latch(index), RW_LOCK_S)); row_sel_open_pcur(plan, search_latch_locked, mtr); @@ -1564,6 +1562,7 @@ func_exit: } return(ret); } +#endif /* BTR_CUR_HASH_ADAPT */ /*********************************************************************//** Performs a select step. @@ -1582,7 +1581,6 @@ row_sel( rec_t* rec; rec_t* old_vers; rec_t* clust_rec; - ibool search_latch_locked; ibool consistent_read; /* The following flag becomes TRUE when we are doing a @@ -1601,7 +1599,6 @@ row_sel( contains a clustered index latch, and &mtr must be committed before we move to the next non-clustered record */ - ulint found_flag; dberr_t err; mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; @@ -1610,7 +1607,11 @@ row_sel( ut_ad(thr->run_node == node); - search_latch_locked = FALSE; +#ifdef BTR_CUR_HASH_ADAPT + ibool search_latch_locked = FALSE; +#else /* BTR_CUR_HASH_ADAPT */ +# define search_latch_locked false +#endif /* BTR_CUR_HASH_ADAPT */ if (node->read_view) { /* In consistent reads, we try to do with the hash index and @@ -1657,11 +1658,12 @@ table_loop: mtr_start(&mtr); +#ifdef BTR_CUR_HASH_ADAPT if (consistent_read && plan->unique_search && !plan->pcur_is_open && !plan->must_get_clust && !plan->table->big_rows) { if (!search_latch_locked) { - rw_lock_s_lock(btr_get_search_latch(index)); + btr_search_s_lock(index); search_latch_locked = TRUE; } else if (rw_lock_get_writer(btr_get_search_latch(index)) @@ -1674,25 +1676,23 @@ table_loop: from acquiring an s-latch for a long time, lowering performance significantly in multiprocessors. */ - rw_lock_s_unlock(btr_get_search_latch(index)); - rw_lock_s_lock(btr_get_search_latch(index)); + btr_search_s_unlock(index); + btr_search_s_lock(index); } - found_flag = row_sel_try_search_shortcut(node, plan, - search_latch_locked, - &mtr); - - if (found_flag == SEL_FOUND) { - + switch (row_sel_try_search_shortcut(node, plan, + search_latch_locked, + &mtr)) { + case SEL_FOUND: goto next_table; - - } else if (found_flag == SEL_EXHAUSTED) { - + case SEL_EXHAUSTED: goto table_exhausted; + default: + ut_ad(0); + case SEL_RETRY: + break; } - ut_ad(found_flag == SEL_RETRY); - plan_reset_cursor(plan); mtr_commit(&mtr); @@ -1700,10 +1700,11 @@ table_loop: } if (search_latch_locked) { - rw_lock_s_unlock(btr_get_search_latch(index)); + btr_search_s_unlock(index); search_latch_locked = FALSE; } +#endif /* BTR_CUR_HASH_ADAPT */ if (!plan->pcur_is_open) { /* Evaluate the expressions to build the search tuple and @@ -2236,13 +2237,15 @@ stop_for_a_while: mtr_commit(&mtr); -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG { btrsea_sync_check check(true); ut_ad(!sync_check_iterate(check)); } -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ err = DB_SUCCESS; goto func_exit; @@ -2291,9 +2294,11 @@ lock_wait_or_error: #endif /* UNIV_DEBUG */ func_exit: +#ifdef BTR_CUR_HASH_ADAPT if (search_latch_locked) { - rw_lock_s_unlock(btr_get_search_latch(index)); + btr_search_s_unlock(index); } +#endif /* BTR_CUR_HASH_ADAPT */ if (heap != NULL) { mem_heap_free(heap); @@ -3077,7 +3082,7 @@ row_sel_store_mysql_field_func( mem_heap_t* heap; /* Copy an externally stored field to a temporary heap */ - ut_a(!prebuilt->trx->has_search_latch); + trx_assert_no_search_latch(prebuilt->trx); ut_ad(field_no == templ->clust_rec_field_no); ut_ad(templ->type != DATA_POINT); @@ -3929,6 +3934,7 @@ row_sel_enqueue_cache_row_for_mysql( ++prebuilt->n_fetch_cached; } +#ifdef BTR_CUR_HASH_ADAPT /*********************************************************************//** Tries to do a shortcut to fetch a clustered index record with a unique key, using the hash index if possible (not always). We assume that the search @@ -3997,6 +4003,7 @@ row_sel_try_search_shortcut_for_mysql( return(SEL_FOUND); } +#endif /* BTR_CUR_HASH_ADAPT */ /*********************************************************************//** Check a pushed-down index condition. @@ -4215,12 +4222,14 @@ row_search_mvcc( DBUG_RETURN(DB_END_OF_INDEX); } -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG { btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); } -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ if (dict_table_is_discarded(prebuilt->table)) { @@ -4248,19 +4257,7 @@ row_search_mvcc( && (prebuilt->read_just_key || prebuilt->m_read_virtual_key); - /*-------------------------------------------------------------*/ - /* PHASE 0: Release a possible s-latch we are holding on the - adaptive hash index latch if there is someone waiting behind */ - - if (trx->has_search_latch) { - - /* There is an x-latch request on the adaptive hash index: - release the s-latch to reduce starvation and wait for - BTR_SEA_TIMEOUT rounds before trying to keep it again over - calls from MySQL */ - - trx_search_latch_release_if_reserved(trx); - } + trx_assert_no_search_latch(trx); /* Reset the new record lock info if srv_locks_unsafe_for_binlog is set or session is using a READ COMMITED isolation level. Then @@ -4379,6 +4376,7 @@ row_search_mvcc( mtr_start(&mtr); +#ifdef BTR_CUR_HASH_ADAPT /*-------------------------------------------------------------*/ /* PHASE 2: Try fast adaptive hash index search if possible */ @@ -4415,7 +4413,7 @@ row_search_mvcc( and if we try that, we can deadlock on the adaptive hash index semaphore! */ - ut_a(!trx->has_search_latch); + trx_assert_no_search_latch(trx); rw_lock_s_lock(btr_get_search_latch(index)); trx->has_search_latch = true; @@ -4503,11 +4501,12 @@ row_search_mvcc( trx->has_search_latch = false; } } +#endif /* BTR_CUR_HASH_ADAPT */ /*-------------------------------------------------------------*/ /* PHASE 3: Open or restore index cursor position */ - trx_search_latch_release_if_reserved(trx); + trx_assert_no_search_latch(trx); spatial_search = dict_index_is_spatial(index) && mode >= PAGE_CUR_CONTAIN; @@ -5813,13 +5812,15 @@ func_exit: } } -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG { btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); } -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ DEBUG_SYNC_C("innodb_row_search_for_mysql_exit"); diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index b8002b439da..2402b4807ba 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -1558,7 +1558,7 @@ row_truncate_update_system_tables( fts_update_next_doc_id(trx, table, NULL, 0); fts_cache_clear(table->fts->cache); fts_cache_init(table->fts->cache); - table->fts->fts_status &= ~TABLE_DICT_LOCKED; + table->fts->fts_status &= uint(~TABLE_DICT_LOCKED); } } diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc index 018866451f6..bf8a326a633 100644 --- a/storage/innobase/srv/srv0conc.cc +++ b/storage/innobase/srv/srv0conc.cc @@ -200,9 +200,7 @@ srv_conc_enter_innodb_with_atomics( /* Release possible search system latch this thread has */ - if (trx->has_search_latch) { - trx_search_latch_release_if_reserved(trx); - } + trx_assert_no_search_latch(trx); thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK); @@ -259,13 +257,15 @@ srv_conc_enter_innodb( { trx_t* trx = prebuilt->trx; -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG { btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); } -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ srv_conc_enter_innodb_with_atomics(trx); } @@ -279,13 +279,15 @@ srv_conc_force_enter_innodb( trx_t* trx) /*!< in: transaction object associated with the thread */ { -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG { btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); } -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ if (!srv_thread_concurrency) { @@ -318,13 +320,15 @@ srv_conc_force_exit_innodb( srv_conc_exit_innodb_with_atomics(trx); -#ifdef UNIV_DEBUG +#ifdef BTR_CUR_HASH_ADAPT +# ifdef UNIV_DEBUG { btrsea_sync_check check(trx->has_search_latch); ut_ad(!sync_check_iterate(check)); } -#endif /* UNIV_DEBUG */ +# endif /* UNIV_DEBUG */ +#endif /* BTR_CUR_HASH_ADAPT */ } /*********************************************************************//** diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index b2722c2a9bf..f42e640f4f3 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -1052,8 +1052,9 @@ static monitor_info_t innodb_counter_info[] = MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_INDEX_DISCARD}, +#ifdef BTR_CUR_HASH_ADAPT /* ========== Counters for Adaptive Hash Index ========== */ - {"module_adaptive_hash", "adaptive_hash_index", "Adpative Hash Index", + {"module_adaptive_hash", "adaptive_hash_index", "Adaptive Hash Index", MONITOR_MODULE, MONITOR_DEFAULT_START, MONITOR_MODULE_ADAPTIVE_HASH}, @@ -1062,6 +1063,7 @@ static monitor_info_t innodb_counter_info[] = static_cast<monitor_type_t>( MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH}, +#endif /* BTR_CUR_HASH_ADAPT */ {"adaptive_hash_searches_btree", "adaptive_hash_index", "Number of searches using B-tree on an index search", @@ -1069,6 +1071,7 @@ static monitor_info_t innodb_counter_info[] = MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE}, +#ifdef BTR_CUR_HASH_ADAPT {"adaptive_hash_pages_added", "adaptive_hash_index", "Number of index pages on which the Adaptive Hash Index is built", MONITOR_NONE, @@ -1100,6 +1103,7 @@ static monitor_info_t innodb_counter_info[] = "Number of Adaptive Hash Index rows updated", MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_UPDATED}, +#endif /* BTR_CUR_HASH_ADAPT */ /* ========== Counters for tablespace ========== */ {"module_file", "file_system", "Tablespace and File System Manager", @@ -2022,9 +2026,11 @@ srv_mon_process_existing_counter( value = log_sys->max_modified_age_sync; break; +#ifdef BTR_CUR_HASH_ADAPT case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH: value = btr_cur_n_sea; break; +#endif /* BTR_CUR_HASH_ADAPT */ case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE: value = btr_cur_n_non_sea; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index a884b5c1bad..e8c6c7a332c 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -507,9 +507,6 @@ thread ensures that we flush the log files at least once per second. */ static time_t srv_last_log_flush_time; -/** Enable semaphore request instrumentation */ -UNIV_INTERN my_bool srv_instrument_semaphores = FALSE; - /* Interval in seconds at which various tasks are performed by the master thread when server is active. In order to balance the workload, we should try to keep intervals such that they are not multiple of @@ -1222,7 +1219,9 @@ srv_refresh_innodb_monitor_stats(void) os_aio_refresh_stats(); +#ifdef BTR_CUR_HASH_ADAPT btr_cur_n_sea_old = btr_cur_n_sea; +#endif /* BTR_CUR_HASH_ADAPT */ btr_cur_n_non_sea_old = btr_cur_n_non_sea; log_refresh_stats(); @@ -1353,6 +1352,7 @@ srv_printf_innodb_monitor( "-------------------------------------\n", file); ibuf_print(file); +#ifdef BTR_CUR_HASH_ADAPT for (ulint i = 0; i < btr_ahi_parts; ++i) { rw_lock_s_lock(btr_search_latches[i]); ha_print_info(file, btr_search_sys->hash_tables[i]); @@ -1366,6 +1366,12 @@ srv_printf_innodb_monitor( (btr_cur_n_non_sea - btr_cur_n_non_sea_old) / time_elapsed); btr_cur_n_sea_old = btr_cur_n_sea; +#else /* BTR_CUR_HASH_ADAPT */ + fprintf(file, + "%.2f non-hash searches/s\n", + (btr_cur_n_non_sea - btr_cur_n_non_sea_old) + / time_elapsed); +#endif /* BTR_CUR_HASH_ADAPT */ btr_cur_n_non_sea_old = btr_cur_n_non_sea; fputs("---\n" diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 8afa90502d0..c360500b884 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1319,7 +1319,7 @@ srv_init_abort_low( bool create_new_db, #ifdef UNIV_DEBUG const char* file, - ulint line, + unsigned line, #endif /* UNIV_DEBUG */ dberr_t err) { @@ -2225,7 +2225,7 @@ files_checked: return(srv_init_abort(err)); } - /* This must precede recv_apply_hashed_log_recs(TRUE). */ + /* This must precede recv_apply_hashed_log_recs(true). */ purge_queue = trx_sys_init_at_db_start(); if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { @@ -2233,14 +2233,9 @@ files_checked: respective file pages, for the last batch of recv_group_scan_log_recs(). */ - err = recv_apply_hashed_log_recs(TRUE); + recv_apply_hashed_log_recs(true); DBUG_PRINT("ib_log", ("apply completed")); - if (err != DB_SUCCESS) { - UT_DELETE(purge_queue); - return(srv_init_abort(err)); - } - if (recv_needed_recovery) { trx_sys_print_mysql_binlog_offset(); } @@ -2843,7 +2838,9 @@ innodb_shutdown() ut_ad(buf_dblwr || !srv_was_started || srv_read_only_mode || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); ut_ad(lock_sys || !srv_was_started); +#ifdef BTR_CUR_HASH_ADAPT ut_ad(btr_search_sys || !srv_was_started); +#endif /* BTR_CUR_HASH_ADAPT */ ut_ad(ibuf || !srv_was_started); ut_ad(log_sys || !srv_was_started); @@ -2864,9 +2861,11 @@ innodb_shutdown() /* This must be disabled before closing the buffer pool and closing the data dictionary. */ +#ifdef BTR_CUR_HASH_ADAPT if (dict_sys) { btr_search_disable(true); } +#endif /* BTR_CUR_HASH_ADAPT */ if (ibuf) { ibuf_close(); } @@ -2901,9 +2900,11 @@ innodb_shutdown() dict_close(); } +#ifdef BTR_CUR_HASH_ADAPT if (btr_search_sys) { btr_search_sys_free(); } +#endif /* BTR_CUR_HASH_ADAPT */ /* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside them */ diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index c9423a04fba..1b561dc3297 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -117,7 +117,7 @@ struct sync_cell_t { const char* file; /*!< in debug version file where requested */ ulint line; /*!< in debug version line where - requested */ + requested, or ULINT_UNDEFINED */ os_thread_id_t thread_id; /*!< thread id of this waiting thread */ bool waiting; /*!< TRUE if the thread has already @@ -213,24 +213,16 @@ sync_array_t::sync_array_t(ulint num_cells) UNIV_NOTHROW : n_reserved(), - n_cells(), - array(), + n_cells(num_cells), + array(UT_NEW_ARRAY_NOKEY(sync_cell_t, num_cells)), mutex(), res_count(), next_free_slot(), - first_free_slot() + first_free_slot(ULINT_UNDEFINED) { ut_a(num_cells > 0); - array = UT_NEW_ARRAY_NOKEY(sync_cell_t, num_cells); - - ulint sz = sizeof(sync_cell_t) * num_cells; - - memset(array, 0x0, sz); - - n_cells = num_cells; - - first_free_slot = ULINT_UNDEFINED; + memset(array, 0x0, sizeof(sync_cell_t) * n_cells); /* Then create the mutex to protect the wait array */ mutex_create(LATCH_ID_SYNC_ARRAY_MUTEX, &mutex); @@ -344,7 +336,7 @@ sync_array_reserve_cell( void* object, /*!< in: pointer to the object to wait for */ ulint type, /*!< in: lock request type */ const char* file, /*!< in: file where requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { sync_cell_t* cell; @@ -604,15 +596,15 @@ sync_array_cell_print( fprintf(file, "number of readers %lu, waiters flag %lu," " lock_word: %lx\n" - "Last time read locked in file %s line %lu\n" - "Last time write locked in file %s line %lu\n", + "Last time read locked in file %s line %u\n" + "Last time write locked in file %s line %u\n", (ulint) rw_lock_get_reader_count(rwlock), (ulint) rwlock->waiters, rwlock->lock_word, innobase_basename(rwlock->last_s_file_name), - (ulint) rwlock->last_s_line, + rwlock->last_s_line, rwlock->last_x_file_name, - (ulint) rwlock->last_x_line); + rwlock->last_x_line); /* JAN: TODO: FIX LATER fprintf(file, @@ -1339,7 +1331,8 @@ sync_arr_fill_sys_semphore_waits_table( (longlong)os_thread_pf(cell->thread))); */ OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_FILE], innobase_basename(cell->file))); - OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LINE], cell->line)); + OK(fields[SYS_SEMAPHORE_WAITS_LINE]->store(cell->line, true)); + fields[SYS_SEMAPHORE_WAITS_LINE]->set_notnull(); OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (ulint)difftime(time(NULL), cell->reservation_time))); if (type == SYNC_MUTEX) { @@ -1352,13 +1345,16 @@ sync_arr_fill_sys_semphore_waits_table( OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_WAIT_TYPE], "MUTEX")); //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)mutex->thread_id)); //OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(mutex->file_name))); - //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE], mutex->line)); + //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(mutex->line, true)); + //fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull(); //OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_CREATED_FILE], innobase_basename(mutex->cfile_name))); - //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_CREATED_LINE], mutex->cline)); + //OK(fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->store(mutex->cline, true)); + //fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->set_notnull(); //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)mutex->waiters)); //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)mutex->lock_word)); //OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(mutex->file_name))); - //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE], mutex->line)); + //OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(mutex->line, true)); + //fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull(); //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], mutex->count_os_wait)); } } else if (type == RW_LOCK_X_WAIT @@ -1398,14 +1394,17 @@ sync_arr_fill_sys_semphore_waits_table( //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)rwlock->thread_id)); //OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(rwlock->file_name))); - //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE], rwlock->line)); + //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(rwlock->line, true)); + //fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull(); OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_READERS], rw_lock_get_reader_count(rwlock))); OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)rwlock->waiters)); OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)rwlock->lock_word)); OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_READER_FILE], innobase_basename(rwlock->last_s_file_name))); - OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE], rwlock->last_s_line)); + OK(fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->store(rwlock->last_s_line, true)); + fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->set_notnull(); OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name))); - OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE], rwlock->last_x_line)); + OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true)); + fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull(); OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], rwlock->count_os_wait)); } } diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc index 5cb90ce5b8d..497f7f3f9e9 100644 --- a/storage/innobase/sync/sync0rw.cc +++ b/storage/innobase/sync/sync0rw.cc @@ -2,6 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. +Copyright (c) 2017, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -202,9 +203,8 @@ rw_lock_create_func( #ifdef UNIV_DEBUG latch_level_t level, /*!< in: level */ #endif /* UNIV_DEBUG */ - const char* cmutex_name, /*!< in: mutex name */ const char* cfile_name, /*!< in: file name where created */ - ulint cline) /*!< in: file line where created */ + unsigned cline) /*!< in: file line where created */ { #if defined(UNIV_DEBUG) && !defined(UNIV_PFS_RWLOCK) /* It should have been created in pfs_rw_lock_create_func() */ @@ -237,11 +237,8 @@ rw_lock_create_func( split the source file anyway. Or create the locks on lines less than 8192. cline is unsigned:13. */ ut_ad(cline <= 8192); - lock->cline = (unsigned int) cline; - lock->lock_name = cmutex_name; + lock->cline = cline; lock->count_os_wait = 0; - lock->file_name = "not yet reserved"; - lock->line = 0; lock->last_s_file_name = "not yet reserved"; lock->last_x_file_name = "not yet reserved"; lock->last_s_line = 0; @@ -299,7 +296,7 @@ rw_lock_s_lock_spin( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ulint i = 0; /* spin round count */ sync_array_t* sync_arr; @@ -429,7 +426,7 @@ rw_lock_x_lock_wait_func( #endif lint threshold,/*!< in: threshold to wait for */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ulint i = 0; ulint n_spins = 0; @@ -479,12 +476,6 @@ rw_lock_x_lock_wait_func( ut_d(rw_lock_remove_debug_info( lock, pass, RW_LOCK_X_WAIT)); - if (srv_instrument_semaphores) { - lock->thread_id = os_thread_get_curr_id(); - lock->file_name = file_name; - lock->line = line; - } - /* It is possible to wake when lock_word < 0. We must pass the while-loop check to proceed.*/ @@ -530,7 +521,7 @@ rw_lock_x_lock_low( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { if (rw_lock_lock_word_decr(lock, X_LOCK_DECR, X_LOCK_HALF_DECR)) { @@ -587,15 +578,8 @@ rw_lock_x_lock_low( ut_d(rw_lock_add_debug_info(lock, pass, RW_LOCK_X, file_name, line)); - - if (srv_instrument_semaphores) { - lock->thread_id = os_thread_get_curr_id(); - lock->file_name = file_name; - lock->line = line; - } - lock->last_x_file_name = file_name; - lock->last_x_line = (unsigned int) line; + lock->last_x_line = line; return(TRUE); } @@ -610,7 +594,7 @@ rw_lock_sx_lock_low( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { if (rw_lock_lock_word_decr(lock, X_LOCK_HALF_DECR, X_LOCK_HALF_DECR)) { @@ -669,7 +653,7 @@ rw_lock_sx_lock_low( ut_d(rw_lock_add_debug_info(lock, pass, RW_LOCK_SX, file_name, line)); lock->last_x_file_name = file_name; - lock->last_x_line = (unsigned int) line; + lock->last_x_line = line; return(TRUE); } @@ -690,7 +674,7 @@ rw_lock_x_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ulint i = 0; sync_array_t* sync_arr; @@ -792,7 +776,7 @@ rw_lock_sx_lock_func( ulint pass, /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name,/*!< in: file name where lock requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ulint i = 0; @@ -945,7 +929,7 @@ rw_lock_add_debug_info( ulint pass, /*!< in: pass value */ ulint lock_type, /*!< in: lock type */ const char* file_name, /*!< in: file where requested */ - ulint line) /*!< in: line where requested */ + unsigned line) /*!< in: line where requested */ { ut_ad(file_name != NULL); diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index cf3109c265e..9c5ae4d02da 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -588,7 +588,9 @@ thd_done: row->trx_foreign_key_error = NULL; } +#ifdef BTR_CUR_HASH_ADAPT row->trx_has_search_latch = (ibool) trx->has_search_latch; +#endif /* BTR_CUR_HASH_ADAPT */ row->trx_is_read_only = trx->read_only; diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 29478edc9e2..609f7f8d39c 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -283,8 +283,7 @@ struct TrxFactory { ut_a(trx->lock.wait_lock == NULL); ut_a(trx->lock.wait_thr == NULL); - ut_a(!trx->has_search_latch); - + trx_assert_no_search_latch(trx); ut_a(trx->dict_operation_lock_mode == 0); if (trx->lock.lock_heap != NULL) { @@ -353,7 +352,7 @@ struct TrxFactory { ut_a(trx->lock.wait_thr == NULL); ut_a(trx->lock.wait_lock == NULL); - ut_a(!trx->has_search_latch); + trx_assert_no_search_latch(trx); ut_a(trx->dict_operation_lock_mode == 0); @@ -2627,10 +2626,12 @@ state_ok: (ulong) n_rec_locks); } +#ifdef BTR_CUR_HASH_ADAPT if (trx->has_search_latch) { newline = TRUE; fputs(", holds adaptive hash latch", f); } +#endif /* BTR_CUR_HASH_ADAPT */ if (trx->undo_no != 0) { newline = TRUE; diff --git a/storage/innobase/ut/ut0dbg.cc b/storage/innobase/ut/ut0dbg.cc index ed4a7778afa..fff1f0e6687 100644 --- a/storage/innobase/ut/ut0dbg.cc +++ b/storage/innobase/ut/ut0dbg.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, 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 the terms of the GNU General Public License as published by the Free Software @@ -34,10 +35,10 @@ ut_dbg_assertion_failed( /*====================*/ const char* expr, /*!< in: the failed assertion (optional) */ const char* file, /*!< in: source file containing the assertion */ - ulint line) /*!< in: line number of the assertion */ + unsigned line) /*!< in: line number of the assertion */ { ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: Assertion failure in file %s line %lu\n", + fprintf(stderr, " InnoDB: Assertion failure in file %s line %u\n", file, line); if (expr) { fprintf(stderr, diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc index 89d2d6c89ea..bf5515f4de0 100644 --- a/storage/innobase/ut/ut0new.cc +++ b/storage/innobase/ut/ut0new.cc @@ -32,7 +32,9 @@ const size_t alloc_max_retries = 60; /** Keys for registering allocations with performance schema. Keep this list alphabetically sorted. */ +#ifdef BTR_CUR_HASH_ADAPT PSI_memory_key mem_key_ahi; +#endif /* BTR_CUR_HASH_ADAPT */ PSI_memory_key mem_key_buf_buf_pool; PSI_memory_key mem_key_dict_stats_bg_recalc_pool_t; PSI_memory_key mem_key_dict_stats_index_map_t; @@ -59,7 +61,9 @@ the list below: (in ut_new_boot()) then mem_key_other is used. Keep this list alphabetically sorted. */ static PSI_memory_info pfs_info[] = { +#ifdef BTR_CUR_HASH_ADAPT {&mem_key_ahi, "adaptive hash index", 0}, +#endif /* BTR_CUR_HASH_ADAPT */ {&mem_key_buf_buf_pool, "buf_buf_pool", 0}, {&mem_key_dict_stats_bg_recalc_pool_t, "dict_stats_bg_recalc_pool_t", 0}, {&mem_key_dict_stats_index_map_t, "dict_stats_index_map_t", 0}, diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h index 3ea1fedf237..c33dfa0d5ea 100644 --- a/storage/maria/ma_blockrec.h +++ b/storage/maria/ma_blockrec.h @@ -50,8 +50,8 @@ #define SUB_RANGE_SIZE 2 #define BLOCK_FILLER_SIZE 2 #define ROW_EXTENT_SIZE (ROW_EXTENT_PAGE_SIZE + ROW_EXTENT_COUNT_SIZE) -#define TAIL_BIT 0x8000 /* Bit in page_count to signify tail */ -#define START_EXTENT_BIT 0x4000 /* Bit in page_count to signify start*/ +#define TAIL_BIT 0x8000U /* Bit in page_count to signify tail */ +#define START_EXTENT_BIT 0x4000U /* Bit in page_count to signify start*/ /* page_count set by bitmap code for tail pages */ #define TAIL_PAGE_COUNT_MARKER 0xffff /* Number of extents reserved MARIA_BITMAP_BLOCKS to store head part */ @@ -75,7 +75,7 @@ #define PAGE_TYPE_MASK 7 enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_TYPE }; -#define PAGE_CAN_BE_COMPACTED 128 /* Bit in PAGE_TYPE */ +#define PAGE_CAN_BE_COMPACTED 128U /* Bit in PAGE_TYPE */ #define PAGE_TYPE_OFFSET LSN_SIZE #define DIR_COUNT_OFFSET (LSN_SIZE+PAGE_TYPE_SIZE) @@ -86,12 +86,12 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_ #define FULL_PAGE_KEY_VERSION_OFFSET (PAGE_TYPE_OFFSET + PAGE_TYPE_SIZE) /* Bits used for flag uchar (one byte, first in record) */ -#define ROW_FLAG_TRANSID 1 -#define ROW_FLAG_VER_PTR 2 -#define ROW_FLAG_DELETE_TRANSID 4 -#define ROW_FLAG_NULLS_EXTENDED 8 -#define ROW_FLAG_EXTENTS 128 -#define ROW_FLAG_ALL (1+2+4+8+128) +#define ROW_FLAG_TRANSID 1U +#define ROW_FLAG_VER_PTR 2U +#define ROW_FLAG_DELETE_TRANSID 4U +#define ROW_FLAG_NULLS_EXTENDED 8U +#define ROW_FLAG_EXTENTS 128U +#define ROW_FLAG_ALL (1U+2U+4U+8U+128U) /* Size for buffer to hold information about bitmap */ #define MAX_BITMAP_INFO_LENGTH ((MARIA_MAX_KEY_BLOCK_LENGTH*8/3)*(61*11/60)+10) @@ -99,8 +99,8 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_ /******** Variables that affects how data pages are utilized ********/ -/* Minium size of tail segment */ -#define MIN_TAIL_SIZE 32 +/* Minimum size of tail segment */ +#define MIN_TAIL_SIZE 32U /* Fixed length part of Max possible header size; See row data structure diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h index 5ac6d67413a..3719ec5e666 100644 --- a/storage/maria/ma_loghandler.h +++ b/storage/maria/ma_loghandler.h @@ -33,9 +33,9 @@ We allow all kind protections to be switched on together for people who really unsure in their hardware/OS. */ -#define TRANSLOG_PAGE_CRC 1 -#define TRANSLOG_SECTOR_PROTECTION (1<<1) -#define TRANSLOG_RECORD_CRC (1<<2) +#define TRANSLOG_PAGE_CRC 1U +#define TRANSLOG_SECTOR_PROTECTION (1U<<1) +#define TRANSLOG_RECORD_CRC (1U<<2) #define TRANSLOG_FLAGS_NUM ((TRANSLOG_PAGE_CRC | TRANSLOG_SECTOR_PROTECTION | \ TRANSLOG_RECORD_CRC) + 1) diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 0c1c56dfa94..0e347cbbd47 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -384,13 +384,13 @@ static struct my_option my_long_options[] = &check_param.read_buffer_length, &check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + ~0ULL, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "Write buffer size for sequential writes during repair of fixed size or dynamic size rows", &check_param.write_buffer_length, &check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, - (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + ~0UL, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "Size of sort buffer. Used by --recover", &check_param.sort_buffer_length, diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 19910f4288d..f3c66e87c46 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -710,49 +710,49 @@ struct st_maria_handler #define F_EXTRA_LCK -1 /* bits in opt_flag */ -#define MEMMAP_USED 32 -#define REMEMBER_OLD_POS 64 +#define MEMMAP_USED 32U +#define REMEMBER_OLD_POS 64U -#define WRITEINFO_UPDATE_KEYFILE 1 -#define WRITEINFO_NO_UNLOCK 2 +#define WRITEINFO_UPDATE_KEYFILE 1U +#define WRITEINFO_NO_UNLOCK 2U /* once_flags */ -#define USE_PACKED_KEYS 1 -#define RRND_PRESERVE_LASTINX 2 +#define USE_PACKED_KEYS 1U +#define RRND_PRESERVE_LASTINX 2U /* bits in state.changed */ -#define STATE_CHANGED 1 -#define STATE_CRASHED 2 -#define STATE_CRASHED_ON_REPAIR 4 -#define STATE_NOT_ANALYZED 8 -#define STATE_NOT_OPTIMIZED_KEYS 16 -#define STATE_NOT_SORTED_PAGES 32 -#define STATE_NOT_OPTIMIZED_ROWS 64 -#define STATE_NOT_ZEROFILLED 128 -#define STATE_NOT_MOVABLE 256 -#define STATE_MOVED 512 /* set if base->uuid != maria_uuid */ -#define STATE_IN_REPAIR 1024 /* We are running repair on table */ -#define STATE_CRASHED_PRINTED 2048 +#define STATE_CHANGED 1U +#define STATE_CRASHED 2U +#define STATE_CRASHED_ON_REPAIR 4U +#define STATE_NOT_ANALYZED 8U +#define STATE_NOT_OPTIMIZED_KEYS 16U +#define STATE_NOT_SORTED_PAGES 32U +#define STATE_NOT_OPTIMIZED_ROWS 64U +#define STATE_NOT_ZEROFILLED 128U +#define STATE_NOT_MOVABLE 256U +#define STATE_MOVED 512U /* set if base->uuid != maria_uuid */ +#define STATE_IN_REPAIR 1024U /* We are running repair on table */ +#define STATE_CRASHED_PRINTED 2048U #define STATE_CRASHED_FLAGS (STATE_CRASHED | STATE_CRASHED_ON_REPAIR | STATE_CRASHED_PRINTED) /* options to maria_read_cache */ -#define READING_NEXT 1 -#define READING_HEADER 2 +#define READING_NEXT 1U +#define READING_HEADER 2U /* Number of bytes on key pages to indicate used size */ -#define KEYPAGE_USED_SIZE 2 -#define KEYPAGE_KEYID_SIZE 1 -#define KEYPAGE_FLAG_SIZE 1 -#define KEYPAGE_KEY_VERSION_SIZE 4 /* encryption */ -#define KEYPAGE_CHECKSUM_SIZE 4 +#define KEYPAGE_USED_SIZE 2U +#define KEYPAGE_KEYID_SIZE 1U +#define KEYPAGE_FLAG_SIZE 1U +#define KEYPAGE_KEY_VERSION_SIZE 4U /* encryption */ +#define KEYPAGE_CHECKSUM_SIZE 4U #define MAX_KEYPAGE_HEADER_SIZE (LSN_STORE_SIZE + KEYPAGE_USED_SIZE + \ KEYPAGE_KEYID_SIZE + KEYPAGE_FLAG_SIZE + \ TRANSID_SIZE + KEYPAGE_KEY_VERSION_SIZE) -#define KEYPAGE_FLAG_ISNOD 1 -#define KEYPAGE_FLAG_HAS_TRANSID 2 +#define KEYPAGE_FLAG_ISNOD 1U +#define KEYPAGE_FLAG_HAS_TRANSID 2U #define _ma_get_page_used(share,x) \ ((uint) mi_uint2korr((x) + (share)->keypage_header - KEYPAGE_USED_SIZE)) @@ -886,9 +886,9 @@ struct st_maria_handler #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */ -#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */ -#define PACK_TYPE_SPACE_FIELDS 2 -#define PACK_TYPE_ZERO_FILL 4 +#define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */ +#define PACK_TYPE_SPACE_FIELDS 2U +#define PACK_TYPE_ZERO_FILL 4U #define MARIA_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */ #define MARIA_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size)) @@ -911,12 +911,12 @@ extern mysql_mutex_t THR_LOCK_maria; /* Some tuning parameters */ #define MARIA_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */ -#define MARIA_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */ +#define MARIA_MIN_SIZE_BULK_INSERT_TREE 16384U /* this is per key */ #define MARIA_MIN_ROWS_TO_USE_BULK_INSERT 100 #define MARIA_MIN_ROWS_TO_DISABLE_INDEXES 100 #define MARIA_MIN_ROWS_TO_USE_WRITE_CACHE 10 /* Keep a small buffer for tables only using small blobs */ -#define MARIA_SMALL_BLOB_BUFFER 1024 +#define MARIA_SMALL_BLOB_BUFFER 1024U #define MARIA_MAX_CONTROL_FILE_LOCK_RETRY 30 /* Retry this many times */ /* Some extern variables */ @@ -1247,12 +1247,12 @@ typedef struct st_maria_block_info /* bits in return from _ma_get_block_info */ -#define BLOCK_FIRST 1 -#define BLOCK_LAST 2 -#define BLOCK_DELETED 4 -#define BLOCK_ERROR 8 /* Wrong data */ -#define BLOCK_SYNC_ERROR 16 /* Right data at wrong place */ -#define BLOCK_FATAL_ERROR 32 /* hardware-error */ +#define BLOCK_FIRST 1U +#define BLOCK_LAST 2U +#define BLOCK_DELETED 4U +#define BLOCK_ERROR 8U /* Wrong data */ +#define BLOCK_SYNC_ERROR 16U /* Right data at wrong place */ +#define BLOCK_FATAL_ERROR 32U /* hardware-error */ #define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */ #define MAXERR 20 @@ -1261,17 +1261,17 @@ typedef struct st_maria_block_info #define INDEX_TMP_EXT ".TMM" #define DATA_TMP_EXT ".TMD" -#define UPDATE_TIME 1 -#define UPDATE_STAT 2 -#define UPDATE_SORT 4 -#define UPDATE_AUTO_INC 8 -#define UPDATE_OPEN_COUNT 16 +#define UPDATE_TIME 1U +#define UPDATE_STAT 2U +#define UPDATE_SORT 4U +#define UPDATE_AUTO_INC 8U +#define UPDATE_OPEN_COUNT 16U /* We use MY_ALIGN_DOWN here mainly to ensure that we get stable values for mysqld --help ) */ #define PAGE_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*256L-MALLOC_OVERHEAD, 8192) #define READ_BUFFER_INIT MY_ALIGN_DOWN(1024L*256L-MALLOC_OVERHEAD, 1024) #define SORT_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*256L-MALLOC_OVERHEAD, 1024) -#define MIN_SORT_BUFFER 4096 +#define MIN_SORT_BUFFER 4096U #define fast_ma_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _ma_writeinfo((INFO),0) #define fast_ma_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _ma_readinfo((INFO),F_RDLCK,1) diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index f467d44bcb9..8467daaafc3 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -1,5 +1,6 @@ /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. + Copyright (c) 2017, 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 @@ -92,16 +93,16 @@ typedef struct st_mi_state_info } MI_STATE_INFO; #define MI_STATE_INFO_SIZE (24+14*8+7*4+2*2+8) -#define MI_STATE_KEY_SIZE 8 -#define MI_STATE_KEYBLOCK_SIZE 8 -#define MI_STATE_KEYSEG_SIZE 4 +#define MI_STATE_KEY_SIZE 8U +#define MI_STATE_KEYBLOCK_SIZE 8U +#define MI_STATE_KEYSEG_SIZE 4U #define MI_STATE_EXTRA_SIZE ((MI_MAX_KEY+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + MI_MAX_KEY*HA_MAX_KEY_SEG*MI_STATE_KEYSEG_SIZE) #define MI_KEYDEF_SIZE (2+ 5*2) #define MI_UNIQUEDEF_SIZE (2+1+1) #define HA_KEYSEG_SIZE (6+ 2*2 + 4*2) #define MI_COLUMNDEF_SIZE (2*3+1) #define MI_BASE_INFO_SIZE (5*8 + 8*4 + 4 + 4*2 + 16) -#define MI_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */ +#define MI_INDEX_BLOCK_MARGIN 16U /* Safety margin for .MYI tables */ typedef struct st_mi_base_info { @@ -311,27 +312,27 @@ struct st_myisam_info #define USE_WHOLE_KEY (HA_MAX_KEY_BUFF*2) /* Use whole key in _mi_search() */ #define F_EXTRA_LCK -1 /* bits in opt_flag */ -#define MEMMAP_USED 32 -#define REMEMBER_OLD_POS 64 +#define MEMMAP_USED 32U +#define REMEMBER_OLD_POS 64U -#define WRITEINFO_UPDATE_KEYFILE 1 -#define WRITEINFO_NO_UNLOCK 2 +#define WRITEINFO_UPDATE_KEYFILE 1U +#define WRITEINFO_NO_UNLOCK 2U /* once_flags */ -#define USE_PACKED_KEYS 1 -#define RRND_PRESERVE_LASTINX 2 +#define USE_PACKED_KEYS 1U +#define RRND_PRESERVE_LASTINX 2U /* bits in state.changed */ -#define STATE_CHANGED 1 -#define STATE_CRASHED 2 -#define STATE_CRASHED_ON_REPAIR 4 -#define STATE_NOT_ANALYZED 8 -#define STATE_NOT_OPTIMIZED_KEYS 16 -#define STATE_NOT_SORTED_PAGES 32 +#define STATE_CHANGED 1U +#define STATE_CRASHED 2U +#define STATE_CRASHED_ON_REPAIR 4U +#define STATE_NOT_ANALYZED 8U +#define STATE_NOT_OPTIMIZED_KEYS 16U +#define STATE_NOT_SORTED_PAGES 32U /* options to mi_read_cache */ -#define READING_NEXT 1 -#define READING_HEADER 2 +#define READING_NEXT 1U +#define READING_HEADER 2U #define mi_getint(x) ((uint) mi_uint2korr(x) & 32767) #define mi_putint(x,y,nod) { uint16 boh=(nod ? (uint16) 32768 : 0) + (uint16) (y);\ @@ -384,17 +385,17 @@ struct st_myisam_info #define MI_MAX_DYN_BLOCK_HEADER 20 /* Max prefix of record-block */ #define MI_BLOCK_INFO_HEADER_LENGTH 20 #define MI_DYN_DELETE_BLOCK_HEADER 20 /* length of delete-block-header */ -#define MI_DYN_MAX_BLOCK_LENGTH ((1L << 24)-4L) +#define MI_DYN_MAX_BLOCK_LENGTH ((1UL << 24)-4UL) #define MI_DYN_MAX_ROW_LENGTH (MI_DYN_MAX_BLOCK_LENGTH - MI_SPLIT_LENGTH) -#define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */ +#define MI_DYN_ALIGN_SIZE 4U /* Align blocks on this */ #define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */ -#define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1))) +#define MI_MAX_BLOCK_LENGTH (((1U << 24)-1) & (~(MI_DYN_ALIGN_SIZE-1))) #define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint32)) -#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */ -#define PACK_TYPE_SPACE_FIELDS 2 -#define PACK_TYPE_ZERO_FILL 4 +#define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */ +#define PACK_TYPE_SPACE_FIELDS 2U +#define PACK_TYPE_ZERO_FILL 4U #define MI_FOUND_WRONG_KEY 0x7FFFFFFF /* Impossible value from ha_key_cmp */ #define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH) @@ -402,7 +403,7 @@ struct st_myisam_info #define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */ #define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */ -#define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */ +#define MI_MIN_SIZE_BULK_INSERT_TREE 16384U /* this is per key */ #define MI_MIN_ROWS_TO_USE_BULK_INSERT 100 #define MI_MIN_ROWS_TO_DISABLE_INDEXES 100 #define MI_MIN_ROWS_TO_USE_WRITE_CACHE 10 @@ -609,12 +610,12 @@ typedef struct st_mi_block_info /* Parameter to _mi_get_block_info */ /* bits in return from _mi_get_block_info */ -#define BLOCK_FIRST 1 -#define BLOCK_LAST 2 -#define BLOCK_DELETED 4 -#define BLOCK_ERROR 8 /* Wrong data */ -#define BLOCK_SYNC_ERROR 16 /* Right data at wrong place */ -#define BLOCK_FATAL_ERROR 32 /* hardware-error */ +#define BLOCK_FIRST 1U +#define BLOCK_LAST 2U +#define BLOCK_DELETED 4U +#define BLOCK_ERROR 8U /* Wrong data */ +#define BLOCK_SYNC_ERROR 16U /* Right data at wrong place */ +#define BLOCK_FATAL_ERROR 32U /* hardware-error */ #define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */ #define MAXERR 20 @@ -623,17 +624,17 @@ typedef struct st_mi_block_info /* Parameter to _mi_get_block_info */ #define INDEX_TMP_EXT ".TMM" #define DATA_TMP_EXT ".TMD" -#define UPDATE_TIME 1 -#define UPDATE_STAT 2 -#define UPDATE_SORT 4 -#define UPDATE_AUTO_INC 8 -#define UPDATE_OPEN_COUNT 16 +#define UPDATE_TIME 1U +#define UPDATE_STAT 2U +#define UPDATE_SORT 4U +#define UPDATE_AUTO_INC 8U +#define UPDATE_OPEN_COUNT 16U /* We use MY_ALIGN_DOWN here mainly to ensure that we get stable values for mysqld --help ) */ #define KEY_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L-MALLOC_OVERHEAD, IO_SIZE) #define READ_BUFFER_INIT MY_ALIGN_DOWN(1024L*256L-MALLOC_OVERHEAD, 1024) #define SORT_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*128L-MALLOC_OVERHEAD, 1024) -#define MIN_SORT_BUFFER 4096 +#define MIN_SORT_BUFFER 4096U enum myisam_log_commands { diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h index a7f7a095b9f..6a50134ad44 100644 --- a/storage/perfschema/pfs_events_waits.h +++ b/storage/perfschema/pfs_events_waits.h @@ -1,4 +1,5 @@ /* Copyright (c) 2008, 2011, 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 the terms of the GNU General Public License as published by @@ -97,13 +98,13 @@ struct PFS_events_waits : public PFS_events }; /** TIMED bit in the state flags bitfield. */ -#define STATE_FLAG_TIMED (1<<0) +#define STATE_FLAG_TIMED (1U<<0) /** THREAD bit in the state flags bitfield. */ -#define STATE_FLAG_THREAD (1<<1) +#define STATE_FLAG_THREAD (1U<<1) /** EVENT bit in the state flags bitfield. */ -#define STATE_FLAG_EVENT (1<<2) +#define STATE_FLAG_EVENT (1U<<2) /** DIGEST bit in the state flags bitfield. */ -#define STATE_FLAG_DIGEST (1<<3) +#define STATE_FLAG_DIGEST (1U<<3) void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait); diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 56dbc9ce0dc..929b9778556 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -182,32 +182,32 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_LCL_NAME_QUOTE_STR "`" #define SPIDER_SQL_LCL_NAME_QUOTE_LEN (sizeof(SPIDER_SQL_LCL_NAME_QUOTE_STR) - 1) -#define SPIDER_CONN_KIND_MYSQL (1 << 0) +#define SPIDER_CONN_KIND_MYSQL (1U << 0) #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) -#define SPIDER_CONN_KIND_HS_READ (1 << 2) -#define SPIDER_CONN_KIND_HS_WRITE (1 << 3) +#define SPIDER_CONN_KIND_HS_READ (1U << 2) +#define SPIDER_CONN_KIND_HS_WRITE (1U << 3) #endif -#define SPIDER_SQL_KIND_SQL (1 << 0) -#define SPIDER_SQL_KIND_HANDLER (1 << 1) +#define SPIDER_SQL_KIND_SQL (1U << 0) +#define SPIDER_SQL_KIND_HANDLER (1U << 1) #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET) -#define SPIDER_SQL_KIND_HS (1 << 2) +#define SPIDER_SQL_KIND_HS (1U << 2) #endif -#define SPIDER_SQL_TYPE_SELECT_SQL (1 << 0) -#define SPIDER_SQL_TYPE_INSERT_SQL (1 << 1) -#define SPIDER_SQL_TYPE_UPDATE_SQL (1 << 2) -#define SPIDER_SQL_TYPE_DELETE_SQL (1 << 3) -#define SPIDER_SQL_TYPE_BULK_UPDATE_SQL (1 << 4) -#define SPIDER_SQL_TYPE_TMP_SQL (1 << 5) -#define SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL (1 << 6) -#define SPIDER_SQL_TYPE_OTHER_SQL (1 << 7) -#define SPIDER_SQL_TYPE_HANDLER (1 << 8) -#define SPIDER_SQL_TYPE_SELECT_HS (1 << 9) -#define SPIDER_SQL_TYPE_INSERT_HS (1 << 10) -#define SPIDER_SQL_TYPE_UPDATE_HS (1 << 11) -#define SPIDER_SQL_TYPE_DELETE_HS (1 << 12) -#define SPIDER_SQL_TYPE_OTHER_HS (1 << 13) +#define SPIDER_SQL_TYPE_SELECT_SQL (1U << 0) +#define SPIDER_SQL_TYPE_INSERT_SQL (1U << 1) +#define SPIDER_SQL_TYPE_UPDATE_SQL (1U << 2) +#define SPIDER_SQL_TYPE_DELETE_SQL (1U << 3) +#define SPIDER_SQL_TYPE_BULK_UPDATE_SQL (1U << 4) +#define SPIDER_SQL_TYPE_TMP_SQL (1U << 5) +#define SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL (1U << 6) +#define SPIDER_SQL_TYPE_OTHER_SQL (1U << 7) +#define SPIDER_SQL_TYPE_HANDLER (1U << 8) +#define SPIDER_SQL_TYPE_SELECT_HS (1U << 9) +#define SPIDER_SQL_TYPE_INSERT_HS (1U << 10) +#define SPIDER_SQL_TYPE_UPDATE_HS (1U << 11) +#define SPIDER_SQL_TYPE_DELETE_HS (1U << 12) +#define SPIDER_SQL_TYPE_OTHER_HS (1U << 13) enum spider_bulk_upd_start { SPD_BU_NOT_START, diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 6df49678d52..be07ff7d561 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -9,7 +9,7 @@ IF(ESSENTIALS) ENDIF() ELSE() SET(CPACK_COMPONENTS_USED - "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management") + "Server;Client;Development;SharedLibraries;Documentation;Readme;Debuginfo;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management") ENDIF() SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents") |