Commit 1e5d989d authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-24167: Remove PFS instrumentation of buf_block_t

We always defined PFS_SKIP_BUFFER_MUTEX_RWLOCK, that is,
the latches of the buffer pool blocks were never instrumented
in PERFORMANCE_SCHEMA.

For some reason, the debug_latch (which enforce proper usage of
buffer-fixing in debug builds) was instrumented.
parent 156cb94b
......@@ -5,11 +5,7 @@ TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
select name from performance_schema.setup_instruments
where name like "wait/synch/sxlock/%"
and name not in
("wait/synch/sxlock/innodb/buf_block_lock",
"wait/synch/sxlock/innodb/buf_block_debug_latch")
order by name;
where name like "wait/synch/sxlock/%" order by name;
name
wait/synch/sxlock/innodb/btr_search_latch
wait/synch/sxlock/innodb/dict_operation_lock
......
......@@ -16,13 +16,8 @@ TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
# Check some SX-locks classes are instrumented
# (exclude instruments that depend on compiling options)
select name from performance_schema.setup_instruments
where name like "wait/synch/sxlock/%"
and name not in
("wait/synch/sxlock/innodb/buf_block_lock",
"wait/synch/sxlock/innodb/buf_block_debug_latch")
order by name;
where name like "wait/synch/sxlock/%" order by name;
# Check some SX-locks instances are instrumented
select name from performance_schema.rwlock_instances
......
......@@ -343,22 +343,6 @@ in the debug version */
static ulint buf_dbg_counter;
#endif /* UNIV_DEBUG */
#if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
/* If defined, register buf_block_t::lock
in one group after their initialization. */
# define PFS_GROUP_BUFFER_SYNC
/* This define caps the number of mutexes/rwlocks can
be registered with performance schema. Developers can
modify this define if necessary. Please note, this would
be effective only if PFS_GROUP_BUFFER_SYNC is defined. */
# define PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER ULINT_MAX
# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
#endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
/** Macro to determine whether the read of write counter is used depending
on the io_type */
#define MONITOR_RW_COUNTER(io_type, counter) \
......@@ -1217,52 +1201,6 @@ void buf_page_print(const byte* read_buf, ulint zip_size)
}
}
# ifdef PFS_GROUP_BUFFER_SYNC
/********************************************************************//**
This function registers mutexes and rwlocks in buffer blocks with
performance schema. If PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER is
defined to be a value less than chunk->size, then only mutexes
and rwlocks in the first PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER
blocks are registered. */
static
void
pfs_register_buffer_block(
/*======================*/
buf_pool_t::chunk_t* chunk) /*!< in/out: chunk of buffers */
{
buf_block_t* block;
ulint num_to_register;
block = chunk->blocks;
num_to_register = ut_min(
chunk->size, PFS_MAX_BUFFER_MUTEX_LOCK_REGISTER);
for (ulint i = 0; i < num_to_register; i++) {
rw_lock_t* rwlock;
# ifdef UNIV_PFS_RWLOCK
rwlock = &block->lock;
ut_a(!rwlock->pfs_psi);
rwlock->pfs_psi = (PSI_server)
? PSI_server->init_rwlock(buf_block_lock_key, rwlock)
: NULL;
# ifdef UNIV_DEBUG
rwlock = block->debug_latch;
ut_a(!rwlock->pfs_psi);
rwlock->pfs_psi = (PSI_server)
? PSI_server->init_rwlock(buf_block_debug_latch_key,
rwlock)
: NULL;
# endif /* UNIV_DEBUG */
# endif /* UNIV_PFS_RWLOCK */
block++;
}
}
# endif /* PFS_GROUP_BUFFER_SYNC */
/** Initialize a buffer page descriptor.
@param[in,out] block buffer page descriptor
@param[in] frame buffer page frame */
......@@ -1288,28 +1226,11 @@ buf_block_init(buf_block_t* block, byte* frame)
ut_d(block->debug_latch = (rw_lock_t *) ut_malloc_nokey(sizeof(rw_lock_t)));
#if defined PFS_SKIP_BUFFER_MUTEX_RWLOCK || defined PFS_GROUP_BUFFER_SYNC
/* If PFS_SKIP_BUFFER_MUTEX_RWLOCK is defined, skip registration
of buffer block rwlock with performance schema.
If PFS_GROUP_BUFFER_SYNC is defined, skip the registration
since buffer block rwlock will be registered later in
pfs_register_buffer_block(). */
rw_lock_create(PFS_NOT_INSTRUMENTED, &block->lock, SYNC_LEVEL_VARYING);
ut_d(rw_lock_create(PFS_NOT_INSTRUMENTED, block->debug_latch,
SYNC_LEVEL_VARYING));
#else /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
rw_lock_create(buf_block_lock_key, &block->lock, SYNC_LEVEL_VARYING);
ut_d(rw_lock_create(buf_block_debug_latch_key,
block->debug_latch, SYNC_LEVEL_VARYING));
#endif /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
block->lock.is_block_lock = 1;
ut_ad(rw_lock_validate(&(block->lock)));
......@@ -1396,9 +1317,6 @@ inline bool buf_pool_t::chunk_t::create(size_t bytes)
reg();
#ifdef PFS_GROUP_BUFFER_SYNC
pfs_register_buffer_block(this);
#endif /* PFS_GROUP_BUFFER_SYNC */
return true;
}
......
......@@ -575,12 +575,6 @@ performance schema instrumented if "UNIV_PFS_RWLOCK"
is defined */
static PSI_rwlock_info all_innodb_rwlocks[] = {
PSI_RWLOCK_KEY(btr_search_latch),
# ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
PSI_RWLOCK_KEY(buf_block_lock),
# endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
# ifdef UNIV_DEBUG
PSI_RWLOCK_KEY(buf_block_debug_latch),
# endif /* UNIV_DEBUG */
PSI_RWLOCK_KEY(dict_operation_lock),
PSI_RWLOCK_KEY(fil_space_latch),
PSI_RWLOCK_KEY(fts_cache_rw_lock),
......
......@@ -37,14 +37,6 @@ Created 9/5/1995 Heikki Tuuri
#include "univ.i"
#if defined UNIV_PFS_MUTEX || defined UNIV_PFS_RWLOCK
/* By default, buffer mutexes and rwlocks will be excluded from
instrumentation due to their large number of instances. */
# define PFS_SKIP_BUFFER_MUTEX_RWLOCK
#endif /* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
#ifdef UNIV_PFS_MUTEX
/* Key defines to register InnoDB mutexes with performance schema */
extern mysql_pfs_key_t buf_pool_mutex_key;
......@@ -96,10 +88,6 @@ extern mysql_pfs_key_t read_view_mutex_key;
/* Following are rwlock keys used to register with MySQL
performance schema */
extern mysql_pfs_key_t btr_search_latch_key;
extern mysql_pfs_key_t buf_block_lock_key;
# ifdef UNIV_DEBUG
extern mysql_pfs_key_t buf_block_debug_latch_key;
# endif /* UNIV_DEBUG */
extern mysql_pfs_key_t dict_operation_lock_key;
extern mysql_pfs_key_t fil_space_latch_key;
extern mysql_pfs_key_t fts_cache_rw_lock_key;
......
......@@ -1307,11 +1307,11 @@ sync_latch_meta_init()
LATCH_ADD_RWLOCK(BTR_SEARCH, SYNC_SEARCH_SYS, btr_search_latch_key);
LATCH_ADD_RWLOCK(BUF_BLOCK_LOCK, SYNC_LEVEL_VARYING,
buf_block_lock_key);
PFS_NOT_INSTRUMENTED);
#ifdef UNIV_DEBUG
LATCH_ADD_RWLOCK(BUF_BLOCK_DEBUG, SYNC_LEVEL_VARYING,
buf_block_debug_latch_key);
PFS_NOT_INSTRUMENTED);
#endif /* UNIV_DEBUG */
LATCH_ADD_RWLOCK(DICT_OPERATION, SYNC_DICT_OPERATION,
......
......@@ -82,10 +82,6 @@ mysql_pfs_key_t read_view_mutex_key;
#endif /* UNIV_PFS_MUTEX */
#ifdef UNIV_PFS_RWLOCK
mysql_pfs_key_t btr_search_latch_key;
mysql_pfs_key_t buf_block_lock_key;
# ifdef UNIV_DEBUG
mysql_pfs_key_t buf_block_debug_latch_key;
# endif /* UNIV_DEBUG */
mysql_pfs_key_t dict_operation_lock_key;
mysql_pfs_key_t index_tree_rw_lock_key;
mysql_pfs_key_t index_online_log_key;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment