mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
branches/zip
SHOW ENGINE INNODB MUTEX shows all mutexes and rw_locks. This can be overwhelming particularly when the buffer pool is very large (note that each block in buffer pool has at least one mutex, one rw_lock and an additional mutex if rw_lock does not use atomics). With this patch status of following mutexes and rw-locks is not shown: 1) block->mutex 2) block->lock 3) block->lock->mutex (if applicable) 4) All other mutexes and rw-locks for which number of os-waits are zero Addresses issue# 179 rb://99 Approved by: Marko
This commit is contained in:
parent
6cf14ddda4
commit
b76aa20cbc
3 changed files with 54 additions and 15 deletions
|
@ -1933,6 +1933,36 @@ buf_block_align(
|
|||
return(NULL);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Find out if a pointer belongs to a buf_block_t. It can be a pointer to
|
||||
the buf_block_t itself or a member of it */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
buf_pointer_is_block_field(
|
||||
/*=======================*/
|
||||
/* out: TRUE if ptr belongs
|
||||
to a buf_block_t struct */
|
||||
const void* ptr) /* in: pointer not
|
||||
dereferenced */
|
||||
{
|
||||
const buf_chunk_t* chunk = buf_pool->chunks;
|
||||
const buf_chunk_t* const echunk = chunk + buf_pool->n_chunks;
|
||||
|
||||
/* TODO: protect buf_pool->chunks with a mutex (it will
|
||||
currently remain constant after buf_pool_init()) */
|
||||
while (chunk < echunk) {
|
||||
if (ptr >= (void *)chunk->blocks
|
||||
&& ptr < (void *)(chunk->blocks + chunk->size)) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
chunk++;
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Find out if a buffer block was created by buf_chunk_init(). */
|
||||
static
|
||||
|
@ -1945,9 +1975,6 @@ buf_block_is_uncompressed(
|
|||
const buf_block_t* block) /* in: pointer to block,
|
||||
not dereferenced */
|
||||
{
|
||||
const buf_chunk_t* chunk = buf_pool->chunks;
|
||||
const buf_chunk_t* const echunk = chunk + buf_pool->n_chunks;
|
||||
|
||||
ut_ad(buf_pool_mutex_own());
|
||||
|
||||
if (UNIV_UNLIKELY((((ulint) block) % sizeof *block) != 0)) {
|
||||
|
@ -1955,17 +1982,7 @@ buf_block_is_uncompressed(
|
|||
return(FALSE);
|
||||
}
|
||||
|
||||
while (chunk < echunk) {
|
||||
if (block >= chunk->blocks
|
||||
&& block < chunk->blocks + chunk->size) {
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
chunk++;
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
return(buf_pointer_is_block_field((void *)block));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
|
|
@ -8043,6 +8043,10 @@ innodb_mutex_show_status(
|
|||
mutex = UT_LIST_GET_FIRST(mutex_list);
|
||||
|
||||
while (mutex != NULL) {
|
||||
if (mutex->count_os_wait == 0
|
||||
|| buf_pool_is_block_mutex(mutex)) {
|
||||
goto next_mutex;
|
||||
}
|
||||
#ifdef UNIV_DEBUG
|
||||
if (mutex->mutex_type != 1) {
|
||||
if (mutex->count_using > 0) {
|
||||
|
@ -8091,6 +8095,7 @@ innodb_mutex_show_status(
|
|||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
next_mutex:
|
||||
mutex = UT_LIST_GET_NEXT(list, mutex);
|
||||
}
|
||||
|
||||
|
@ -8101,7 +8106,8 @@ innodb_mutex_show_status(
|
|||
lock = UT_LIST_GET_FIRST(rw_lock_list);
|
||||
|
||||
while (lock != NULL) {
|
||||
if (lock->count_os_wait) {
|
||||
if (lock->count_os_wait
|
||||
&& !buf_pool_is_block_lock(lock)) {
|
||||
buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu",
|
||||
lock->cfile_name, (ulong) lock->cline);
|
||||
buf2len= my_snprintf(buf2, sizeof(buf2),
|
||||
|
|
|
@ -906,6 +906,22 @@ buf_block_align(
|
|||
/*============*/
|
||||
/* out: pointer to block, never NULL */
|
||||
const byte* ptr); /* in: pointer to a frame */
|
||||
/************************************************************************
|
||||
Find out if a pointer belongs to a buf_block_t. It can be a pointer to
|
||||
the buf_block_t itself or a member of it */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
buf_pointer_is_block_field(
|
||||
/*=======================*/
|
||||
/* out: TRUE if ptr belongs
|
||||
to a buf_block_t struct */
|
||||
const void* ptr); /* in: pointer not
|
||||
dereferenced */
|
||||
#define buf_pool_is_block_mutex(m) \
|
||||
buf_pointer_is_block_field((void *)(m))
|
||||
#define buf_pool_is_block_lock(l) \
|
||||
buf_pointer_is_block_field((void *)(l))
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
|
||||
/*************************************************************************
|
||||
Gets the compressed page descriptor corresponding to an uncompressed page
|
||||
|
|
Loading…
Add table
Reference in a new issue