mirror of
https://github.com/MariaDB/server.git
synced 2025-12-01 17:39:21 +03:00
Remove trx_t::has_search_latch and simplify debug code
When the btr_search_latch was split into an array of latches in MySQL 5.7.8 as part of the Oracle Bug#20985298 fix, the "caching" of the latch across storage engine API calls was removed, and the field trx->has_search_latch would only be set during a short time frame in the execution of row_search_mvcc(), which was formerly called row_search_for_mysql(). This means that the column INFORMATION_SCHEMA.INNODB_TRX.TRX_ADAPTIVE_HASH_LATCHED will always report 0. That column cannot be removed in MariaDB 10.2, but it can be removed in future releases. trx_t::has_search_latch: Remove. trx_assert_no_search_latch(): Remove. row_sel_try_search_shortcut_for_mysql(): Remove a redundant condition on trx->has_search_latch (it was always true). sync_check_iterate(): Make the parameter const. sync_check_functor_t: Make the operator() const, and remove result() and the virtual destructor. There is no need to have mutable state in the functors. sync_checker<bool>: Replaces dict_sync_check and btrsea_sync_check. sync_check: Replaces btrsea_sync_check. dict_sync_check: Instantiated from sync_checker. sync_allowed_latches: Use std::find() directly on the array. Remove the std::vector. TrxInInnoDB::enter(), TrxInInnoDB::exit(): Remove obviously redundant debug assertions on trx->in_depth, and use equality comparison against 0 because it could be more efficient on some architectures.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
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
|
||||
@@ -298,29 +298,23 @@ struct LatchDebug {
|
||||
}
|
||||
|
||||
/** Iterate over a thread's latches.
|
||||
@param[in,out] functor The callback
|
||||
@param[in] functor The callback
|
||||
@return true if the functor returns true. */
|
||||
bool for_each(sync_check_functor_t& functor)
|
||||
bool for_each(const sync_check_functor_t& functor)
|
||||
UNIV_NOTHROW
|
||||
{
|
||||
const Latches* latches = thread_latches();
|
||||
if (const Latches* latches = thread_latches()) {
|
||||
Latches::const_iterator end = latches->end();
|
||||
for (Latches::const_iterator it = latches->begin();
|
||||
it != end; ++it) {
|
||||
|
||||
if (latches == 0) {
|
||||
return(functor.result());
|
||||
}
|
||||
|
||||
Latches::const_iterator end = latches->end();
|
||||
|
||||
for (Latches::const_iterator it = latches->begin();
|
||||
it != end;
|
||||
++it) {
|
||||
|
||||
if (functor(it->m_level)) {
|
||||
break;
|
||||
if (functor(it->m_level)) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(functor.result());
|
||||
return(false);
|
||||
}
|
||||
|
||||
/** Removes a latch from the thread level array if it is found there.
|
||||
@@ -1215,13 +1209,12 @@ sync_check_find(latch_level_t level)
|
||||
|
||||
/** Iterate over the thread's latches.
|
||||
@param[in,out] functor called for each element.
|
||||
@return false if the sync debug hasn't been initialised
|
||||
@return the value returned by the functor */
|
||||
@return true if the functor returns true for any element */
|
||||
bool
|
||||
sync_check_iterate(sync_check_functor_t& functor)
|
||||
sync_check_iterate(const sync_check_functor_t& functor)
|
||||
{
|
||||
if (LatchDebug::instance() != NULL) {
|
||||
return(LatchDebug::instance()->for_each(functor));
|
||||
if (LatchDebug* debug = LatchDebug::instance()) {
|
||||
return(debug->for_each(functor));
|
||||
}
|
||||
|
||||
return(false);
|
||||
|
||||
Reference in New Issue
Block a user