diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-29 17:54:10 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-29 17:54:10 +0300 |
commit | 447b8ba1645435cb7d538a6f1b644cad113f4835 (patch) | |
tree | 1fca3981fd9f3829287b5f3b372a0661c7e4273d /storage/innobase | |
parent | 4d59f45260547b3230f177498b6fa07a12647fdc (diff) | |
parent | 810f014ca7a705381e110cb26649c528bc00f179 (diff) | |
download | mariadb-git-447b8ba1645435cb7d538a6f1b644cad113f4835.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/btr/btr0bulk.cc | 2 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buddy.cc | 11 | ||||
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 5 | ||||
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 21 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 19 | ||||
-rw-r--r-- | storage/innobase/include/buf0buf.h | 10 | ||||
-rw-r--r-- | storage/innobase/include/ha_prototypes.h | 3 | ||||
-rw-r--r-- | storage/innobase/include/univ.i | 2 | ||||
-rw-r--r-- | storage/innobase/include/ut0lst.h | 130 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 67 |
10 files changed, 124 insertions, 146 deletions
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index dbbf68ff207..edd26a672be 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -1045,7 +1045,7 @@ BtrBulk::finish(dberr_t err) ut_ad(!sync_check_iterate(dict_sync_check())); - ut_ad(err == DB_SUCCESS + ut_ad(err != DB_SUCCESS || btr_validate_index(m_index, NULL, false) == DB_SUCCESS); return(err); } diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index 3b784494fda..a41345b43ab 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -171,13 +171,13 @@ buf_buddy_get( struct CheckZipFree { CheckZipFree(ulint i) : m_i(i) {} - void operator()(const buf_buddy_free_t* elem) const + void operator()(const buf_buddy_free_t* elem) const { - ut_a(buf_buddy_stamp_is_free(elem)); - ut_a(elem->stamp.size <= m_i); + ut_ad(buf_buddy_stamp_is_free(elem)); + ut_ad(elem->stamp.size <= m_i); } - ulint m_i; + const ulint m_i; }; /** Validate a buddy list. @@ -189,8 +189,7 @@ buf_buddy_list_validate( const buf_pool_t* buf_pool, ulint i) { - CheckZipFree check(i); - ut_list_validate(buf_pool->zip_free[i], check); + ut_list_validate(buf_pool->zip_free[i], CheckZipFree(i)); } /**********************************************************************//** diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index fd9d4713a9c..e3c45863c8b 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -3567,7 +3567,7 @@ buf_flush_request_force( /** Functor to validate the flush list. */ struct Check { - void operator()(const buf_page_t* elem) + void operator()(const buf_page_t* elem) const { ut_a(elem->in_flush_list); } @@ -3584,11 +3584,10 @@ buf_flush_validate_low( { buf_page_t* bpage; const ib_rbt_node_t* rnode = NULL; - Check check; ut_ad(buf_flush_list_mutex_own(buf_pool)); - ut_list_validate(buf_pool->flush_list, check); + ut_list_validate(buf_pool->flush_list, Check()); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index fce7c6a98fe..7ed703de5d7 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -548,13 +548,9 @@ bool fil_node_t::read_page0(bool first) return false; } - ut_ad(space->free_limit == 0 || space->free_limit == free_limit); - ut_ad(space->free_len == 0 || space->free_len == free_len); - space->size_in_header = size; - space->free_limit = free_limit; - space->free_len = free_len; - if (first) { + ut_ad(space->id != TRX_SYS_SPACE); + /* Truncate the size to a multiple of extent size. */ ulint mask = psize * FSP_EXTENT_SIZE - 1; @@ -567,8 +563,19 @@ bool fil_node_t::read_page0(bool first) this->size = ulint(size_bytes / psize); space->size += this->size; + } else if (space->id != TRX_SYS_SPACE || space->size_in_header) { + /* If this is not the first-time open, do nothing. + For the system tablespace, we always get invoked as + first=false, so we detect the true first-time-open based + on size_in_header and proceed to initiailze the data. */ + return true; } + ut_ad(space->free_limit == 0 || space->free_limit == free_limit); + ut_ad(space->free_len == 0 || space->free_len == free_len); + space->size_in_header = size; + space->free_limit = free_limit; + space->free_len = free_len; return true; } @@ -4658,7 +4665,7 @@ fil_validate(void) ut_a(fil_system.n_open == n_open); - UT_LIST_CHECK(fil_system.LRU); + ut_list_validate(fil_system.LRU); for (fil_node = UT_LIST_GET_FIRST(fil_system.LRU); fil_node != 0; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 10b8c0e61a9..e0e0afd3dc7 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6135,9 +6135,9 @@ no_such_table: << n_cols << " user" " defined columns in InnoDB, but " << n_fields << " columns in MariaDB. Please check" - " INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " REFMAN - "innodb-troubleshooting.html for how to resolve the" - " issue."; + " INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and" + " https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/" + " for how to resolve the issue."; /* Mark this table as corrupted, so the drop table or force recovery can still use it, but not others. */ @@ -21150,11 +21150,11 @@ ib_errf( /* Keep the first 16 characters as-is, since the url is sometimes used as an offset from this.*/ const char* TROUBLESHOOTING_MSG = - "Please refer to " REFMAN "innodb-troubleshooting.html" + "Please refer to https://mariadb.com/kb/en/innodb-troubleshooting/" " for how to resolve the issue."; const char* TROUBLESHOOT_DATADICT_MSG = - "Please refer to " REFMAN "innodb-troubleshooting-datadict.html" + "Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/" " for how to resolve the issue."; const char* BUG_REPORT_MSG = @@ -21165,9 +21165,6 @@ const char* FORCE_RECOVERY_MSG = "https://mariadb.com/kb/en/library/innodb-recovery-modes/" " for information about forcing recovery."; -const char* ERROR_CREATING_MSG = - "Please refer to " REFMAN "error-creating-innodb.html"; - const char* OPERATING_SYSTEM_ERROR_MSG = "Some operating system error numbers are described at" " https://mariadb.com/kb/en/library/operating-system-error-codes/"; @@ -21555,8 +21552,7 @@ ib_push_frm_error( " Have you mixed up " ".frm files from different " "installations? See " - REFMAN - "innodb-troubleshooting.html\n", + "https://mariadb.com/kb/en/innodb-troubleshooting/\n", ib_table->name.m_name); if (push_warning) { @@ -21599,8 +21595,7 @@ ib_push_frm_error( " Have you mixed up " ".frm files from different " "installations? See " - REFMAN - "innodb-troubleshooting.html\n", + "https://mariadb.com/kb/en/innodb-troubleshooting/\n", ib_table->name.m_name, n_keys, table->s->keys); diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 5c6360823bf..64716703b40 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -2427,8 +2427,7 @@ struct CheckInLRUList { static void validate(const buf_pool_t* buf_pool) { - CheckInLRUList check; - ut_list_validate(buf_pool->LRU, check); + ut_list_validate(buf_pool->LRU, CheckInLRUList()); } }; @@ -2441,8 +2440,7 @@ struct CheckInFreeList { static void validate(const buf_pool_t* buf_pool) { - CheckInFreeList check; - ut_list_validate(buf_pool->free, check); + ut_list_validate(buf_pool->free, CheckInFreeList()); } }; @@ -2455,8 +2453,8 @@ struct CheckUnzipLRUAndLRUList { static void validate(const buf_pool_t* buf_pool) { - CheckUnzipLRUAndLRUList check; - ut_list_validate(buf_pool->unzip_LRU, check); + ut_list_validate(buf_pool->unzip_LRU, + CheckUnzipLRUAndLRUList()); } }; #endif /* UNIV_DEBUG || defined UNIV_BUF_DEBUG */ diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 88b5e181efe..0e3402d2864 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -431,7 +431,6 @@ extern const char* TROUBLESHOOTING_MSG; extern const char* TROUBLESHOOT_DATADICT_MSG; extern const char* BUG_REPORT_MSG; extern const char* FORCE_RECOVERY_MSG; -extern const char* ERROR_CREATING_MSG; extern const char* OPERATING_SYSTEM_ERROR_MSG; extern const char* FOREIGN_KEY_CONSTRAINTS_MSG; extern const char* SET_TRANSACTION_MSG; diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index b66c4a96c9b..69e8e9eb96e 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -53,8 +53,6 @@ component, i.e. we show M.N.P as M.N */ IB_TO_STR(MYSQL_VERSION_MINOR) "." \ IB_TO_STR(MYSQL_VERSION_PATCH) -#define REFMAN "http://dev.mysql.com/doc/refman/5.7/en/" - /** How far ahead should we tell the service manager the timeout (time in seconds) */ #define INNODB_EXTEND_TIMEOUT_INTERVAL 30 diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h index f62d3744b96..986f73ea17c 100644 --- a/storage/innobase/include/ut0lst.h +++ b/storage/innobase/include/ut0lst.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -426,24 +427,19 @@ Gets the last node in a two-way list. @return last node, or NULL if the list is empty */ #define UT_LIST_GET_LAST(BASE) (BASE).end -struct NullValidate { void operator()(const void*) { } }; +struct NullValidate { void operator()(const void*) const {} }; -/********************************************************************//** -Iterate over all the elements and call the functor for each element. +/** Iterate over all the elements and call the functor for each element. @param[in] list base node (not a pointer to it) @param[in,out] functor Functor that is called for each element in the list */ template <typename List, class Functor> -void -ut_list_map( - const List& list, - Functor& functor) +inline void ut_list_map(const List& list, Functor& functor) { - ulint count = 0; + ulint count = 0; UT_LIST_IS_INITIALISED(list); - for (typename List::elem_type* elem = list.start; - elem != 0; + for (typename List::elem_type* elem = list.start; elem; elem = (elem->*list.node).next, ++count) { functor(elem); @@ -452,32 +448,50 @@ ut_list_map( ut_a(count == list.count); } -template <typename List> -void -ut_list_reverse(List& list) +/** Iterate over all the elements and call the functor for each element. +@param[in] list base node (not a pointer to it) +@param[in] functor Functor that is called for each element in the list */ +template <typename List, class Functor> +inline void ut_list_map(const List& list, const Functor& functor) { + ulint count = 0; + UT_LIST_IS_INITIALISED(list); - for (typename List::elem_type* elem = list.start; + for (typename List::elem_type* elem = list.start; elem; + elem = (elem->*list.node).next, ++count) { + + functor(elem); + } + + ut_a(count == list.count); +} + +/** Check the consistency of a doubly linked list. +@param[in] list base node (not a pointer to it) +@param[in,out] functor Functor that is called for each element in the list */ +template <typename List, class Functor> +void ut_list_validate(const List& list, Functor& functor) +{ + ut_list_map(list, functor); + + /* Validate the list backwards. */ + ulint count = 0; + + for (typename List::elem_type* elem = list.end; elem != 0; elem = (elem->*list.node).prev) { - (elem->*list.node).reverse(); + ++count; } - list.reverse(); + ut_a(count == list.count); } -#define UT_LIST_REVERSE(LIST) ut_list_reverse(LIST) - -/********************************************************************//** -Checks the consistency of a two-way list. -@param[in] list base node (not a pointer to it) -@param[in,out] functor Functor that is called for each element in the list */ +/** Check the consistency of a doubly linked list. +@param[in] list base node (not a pointer to it) +@param[in] functor Functor that is called for each element in the list */ template <typename List, class Functor> -void -ut_list_validate( - const List& list, - Functor& functor) +inline void ut_list_validate(const List& list, const Functor& functor) { ut_list_map(list, functor); @@ -493,12 +507,42 @@ ut_list_validate( ut_a(count == list.count); } -/** Check the consistency of a two-way list. -@param[in] LIST base node reference */ -#define UT_LIST_CHECK(LIST) do { \ - NullValidate nullV; \ - ut_list_validate(LIST, nullV); \ -} while (0) +template <typename List> +inline void ut_list_validate(const List& list) +{ + ut_list_validate(list, NullValidate()); +} + +#ifdef UNIV_DEBUG +template <typename List> +inline void ut_list_reverse(List& list) +{ + UT_LIST_IS_INITIALISED(list); + + for (typename List::elem_type* elem = list.start; + elem != 0; + elem = (elem->*list.node).prev) { + (elem->*list.node).reverse(); + } + + list.reverse(); +} + +/** Check if the given element exists in the list. +@param[in,out] list the list object +@param[in] elem the element of the list which will be checked */ +template <typename List> +inline bool ut_list_exists(const List& list, typename List::elem_type* elem) +{ + for (typename List::elem_type* e1 = UT_LIST_GET_FIRST(list); e1; + e1 = (e1->*list.node).next) { + if (elem == e1) { + return true; + } + } + return false; +} +#endif /** Move the given element to the beginning of the list. @param[in,out] list the list object @@ -519,28 +563,6 @@ ut_list_move_to_front( } #ifdef UNIV_DEBUG -/** Check if the given element exists in the list. -@param[in,out] list the list object -@param[in] elem the element of the list which will be checked */ -template <typename List> -bool -ut_list_exists( - List& list, - typename List::elem_type* elem) -{ - typename List::elem_type* e1; - - for (e1 = UT_LIST_GET_FIRST(list); e1 != NULL; - e1 = (e1->*list.node).next) { - if (elem == e1) { - return(true); - } - } - return(false); -} #endif -#define UT_LIST_MOVE_TO_FRONT(LIST, ELEM) \ - ut_list_move_to_front(LIST, ELEM) - #endif /* ut0lst.h */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 7ef468fae39..1b8394b8790 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -2585,7 +2585,7 @@ lock_move_granted_locks_to_front( if (!lock->is_waiting()) { lock_t* prev = UT_LIST_GET_PREV(trx_locks, lock); ut_a(prev); - UT_LIST_MOVE_TO_FRONT(lock_list, lock); + ut_list_move_to_front(lock_list, lock); lock = prev; } } @@ -2673,7 +2673,7 @@ lock_move_reorganize_page( lock_move_granted_locks_to_front(old_locks); DBUG_EXECUTE_IF("do_lock_reverse_page_reorganize", - UT_LIST_REVERSE(old_locks);); + ut_list_reverse(old_locks);); for (lock = UT_LIST_GET_FIRST(old_locks); lock; lock = UT_LIST_GET_NEXT(trx_locks, lock)) { @@ -4624,29 +4624,6 @@ lock_print_info_summary( return(TRUE); } -/** Functor to print not-started transaction from the trx_list. */ - -struct PrintNotStarted { - - PrintNotStarted(FILE* file) : m_file(file) { } - - void operator()(const trx_t* trx) - { - ut_ad(mutex_own(&trx_sys.mutex)); - - /* See state transitions and locking rules in trx0trx.h */ - - if (trx->mysql_thd - && trx_state_eq(trx, TRX_STATE_NOT_STARTED)) { - - fputs("---", m_file); - trx_print_latched(m_file, trx, 600); - } - } - - FILE* m_file; -}; - /** Prints transaction lock wait and MVCC state. @param[in,out] file file where to print @param[in] trx transaction */ @@ -4719,29 +4696,24 @@ lock_trx_print_locks( } } - -static my_bool lock_print_info_all_transactions_callback( - rw_trx_hash_element_t *element, FILE *file) +/** Functor to display all transactions */ +struct lock_print_info { - mutex_enter(&element->mutex); - if (trx_t *trx= element->trx) + lock_print_info(FILE* file) : file(file) {} + + void operator()(const trx_t* trx) const { - check_trx_state(trx); + ut_ad(mutex_own(&trx_sys.mutex)); + if (trx == purge_sys.query->trx) + return; lock_trx_print_wait_and_mvcc_state(file, trx); - if (srv_print_innodb_lock_monitor) - { - trx->reference(); - mutex_exit(&element->mutex); + if (trx->will_lock && srv_print_innodb_lock_monitor) lock_trx_print_locks(file, trx); - trx->release_reference(); - return 0; - } } - mutex_exit(&element->mutex); - return 0; -} + FILE* const file; +}; /*********************************************************************//** Prints info of locks for each transaction. This function assumes that the @@ -4756,20 +4728,9 @@ lock_print_info_all_transactions( fprintf(file, "LIST OF TRANSACTIONS FOR EACH SESSION:\n"); - /* First print info on non-active transactions */ - - /* NOTE: information of auto-commit non-locking read-only - transactions will be omitted here. The information will be - available from INFORMATION_SCHEMA.INNODB_TRX. */ - - PrintNotStarted print_not_started(file); mutex_enter(&trx_sys.mutex); - ut_list_map(trx_sys.trx_list, print_not_started); + ut_list_map(trx_sys.trx_list, lock_print_info(file)); mutex_exit(&trx_sys.mutex); - - trx_sys.rw_trx_hash.iterate_no_dups( - reinterpret_cast<my_hash_walk_action> - (lock_print_info_all_transactions_callback), file); lock_mutex_exit(); ut_ad(lock_validate()); |