summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-11-20 08:55:41 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-11-20 08:55:41 +0200
commit1e5d989d2ad9035f82853c874229e1380519daac (patch)
tree1634c28eaae7a2f07c997634054b1cc5971423b2
parent156cb94b4b54ca4cccbe7d6821beb84aa376c187 (diff)
downloadmariadb-git-1e5d989d2ad9035f82853c874229e1380519daac.tar.gz
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.
-rw-r--r--mysql-test/suite/perfschema/r/sxlock_func.result6
-rw-r--r--mysql-test/suite/perfschema/t/sxlock_func.test7
-rw-r--r--storage/innobase/buf/buf0buf.cc82
-rw-r--r--storage/innobase/handler/ha_innodb.cc6
-rw-r--r--storage/innobase/include/sync0sync.h12
-rw-r--r--storage/innobase/sync/sync0debug.cc4
-rw-r--r--storage/innobase/sync/sync0sync.cc4
7 files changed, 4 insertions, 117 deletions
diff --git a/mysql-test/suite/perfschema/r/sxlock_func.result b/mysql-test/suite/perfschema/r/sxlock_func.result
index b51234feda6..e7f4ba345c5 100644
--- a/mysql-test/suite/perfschema/r/sxlock_func.result
+++ b/mysql-test/suite/perfschema/r/sxlock_func.result
@@ -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
diff --git a/mysql-test/suite/perfschema/t/sxlock_func.test b/mysql-test/suite/perfschema/t/sxlock_func.test
index 7c7e8fc6189..f5f38f51c78 100644
--- a/mysql-test/suite/perfschema/t/sxlock_func.test
+++ b/mysql-test/suite/perfschema/t/sxlock_func.test
@@ -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
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index eb8cc8f71d3..9e24698d07c 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -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;
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index a35b90e91f0..b12d6cfd695 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -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),
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index ce19178a5ad..b7f3cff2925 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -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;
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index 87646867319..f2f7c13d34c 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -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,
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index c2957a3fdcb..0a6f8bfbebd 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -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;