mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
50faeda4d6
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.
106 lines
3.3 KiB
C
106 lines
3.3 KiB
C
/*****************************************************************************
|
|
|
|
Copyright (c) 2013, 2015, Oracle and/or its affiliates. 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
|
|
briefly in the InnoDB documentation. The contributions by Google are
|
|
incorporated with their permission, and subject to the conditions contained in
|
|
the file COPYING.Google.
|
|
|
|
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
|
|
Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program; if not, write to the Free Software Foundation, Inc.,
|
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
|
|
|
*****************************************************************************/
|
|
|
|
/**************************************************//**
|
|
@file include/sync0debug.h
|
|
Debug checks for latches, header file
|
|
|
|
Created 2012-08-21 Sunny Bains
|
|
*******************************************************/
|
|
|
|
#ifndef sync0debug_h
|
|
#define sync0debug_h
|
|
|
|
#include "univ.i"
|
|
#include "sync0types.h"
|
|
|
|
/** Initializes the synchronization data structures. */
|
|
void
|
|
sync_check_init();
|
|
|
|
/** Free the InnoDB synchronization data structures. */
|
|
void
|
|
sync_check_close();
|
|
|
|
#ifdef UNIV_DEBUG
|
|
/** Enable sync order checking. */
|
|
void
|
|
sync_check_enable();
|
|
|
|
/** Check if it is OK to acquire the latch.
|
|
@param[in] latch latch type */
|
|
void
|
|
sync_check_lock_validate(const latch_t* latch);
|
|
|
|
/** Note that the lock has been granted
|
|
@param[in] latch latch type */
|
|
void
|
|
sync_check_lock_granted(const latch_t* latch);
|
|
|
|
/** Check if it is OK to acquire the latch.
|
|
@param[in] latch latch type
|
|
@param[in] level the level of the mutex */
|
|
void
|
|
sync_check_lock(const latch_t* latch, latch_level_t level);
|
|
|
|
/**
|
|
Check if it is OK to re-acquire the lock. */
|
|
void
|
|
sync_check_relock(const latch_t* latch);
|
|
|
|
/** Removes a latch from the thread level array if it is found there.
|
|
@param[in] latch to unlock */
|
|
void
|
|
sync_check_unlock(const latch_t* latch);
|
|
|
|
/** Checks if the level array for the current thread contains a
|
|
mutex or rw-latch at the specified level.
|
|
@param[in] level to find
|
|
@return a matching latch, or NULL if not found */
|
|
const latch_t*
|
|
sync_check_find(latch_level_t level);
|
|
|
|
/** Checks that the level array for the current thread is empty.
|
|
Terminate iteration if the functor returns true.
|
|
@param[in] functor called for each element.
|
|
@return true if the functor returns true for any element */
|
|
bool
|
|
sync_check_iterate(const sync_check_functor_t& functor);
|
|
|
|
/** Acquires the debug mutex. We cannot use the mutex defined in sync0sync,
|
|
because the debug mutex is also acquired in sync0arr while holding the OS
|
|
mutex protecting the sync array, and the ordinary mutex_enter might
|
|
recursively call routines in sync0arr, leading to a deadlock on the OS
|
|
mutex. */
|
|
void
|
|
rw_lock_debug_mutex_enter();
|
|
|
|
/** Releases the debug mutex. */
|
|
void
|
|
rw_lock_debug_mutex_exit();
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
#endif /* !sync0debug_h */
|