summaryrefslogtreecommitdiff
path: root/storage/innobase/fil
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@oracle.com>2010-12-01 10:43:33 +0200
committerMarko Mäkelä <marko.makela@oracle.com>2010-12-01 10:43:33 +0200
commitd6bac7db8e586b6c2f3224a8271ebbabc8e5524e (patch)
tree9bb4fb6eb6d8caeb9bb167a8718f127ac67b7f24 /storage/innobase/fil
parent2a4aca3e6869d3d03538c0013832b70ebc093aae (diff)
downloadmariadb-git-d6bac7db8e586b6c2f3224a8271ebbabc8e5524e.tar.gz
Bug#58226 Some InnoDB debug checks consume too much CPU time
Do not disable InnoDB inlining when UNIV_DEBUG is defined. The inlining is now solely controlled by the preprocessor symbol UNIV_MUST_NOT_INLINE and by any compiler options. mtr_memo_contains(): Add an explicit type conversion from void*, so that the function can be compiled by a C++ compiler. Previously, this function was never seen by the C++ compiler, because it is only present in UNIV_DEBUG builds and InnoDB inlining used to be disabled. buf_flush_validate_skip(): A wrapper that skips most calls of buf_flush_validate_low(). Invoked by debug assertions in buf_flush_insert_into_flush_list() and buf_flush_remove(). fil_validate_skip(): A wrapper that skips most calls of fil_validate(). Invoked by debug assertions in fil_io() and fil_io_wait(). os_aio_validate_skip(): A wrapper that skips most calls of os_aio_validate(). Invoked by debug assertions in os_aio_func(), os_aio_windows_handle() and os_aio_simulated_handle. os_get_os_version(): Only include this function if __WIN__ is defined. sync_array_deadlock_step(): Slight optimizations. This function is a major CPU consumer in UNIV_SYNC_DEBUG builds.
Diffstat (limited to 'storage/innobase/fil')
-rw-r--r--storage/innobase/fil/fil0fil.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index cb4ccc005b5..d940bc70609 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -299,6 +299,34 @@ struct fil_system_struct {
initialized. */
static fil_system_t* fil_system = NULL;
+#ifdef UNIV_DEBUG
+/** Try fil_validate() every this many times */
+# define FIL_VALIDATE_SKIP 17
+
+/******************************************************************//**
+Checks the consistency of the tablespace cache some of the time.
+@return TRUE if ok or the check was skipped */
+static
+ibool
+fil_validate_skip(void)
+/*===================*/
+{
+ /** The fil_validate() call skip counter. Use a signed type
+ because of the race condition below. */
+ static int fil_validate_count = FIL_VALIDATE_SKIP;
+
+ /* There is a race condition below, but it does not matter,
+ because this call is only for heuristic purposes. We want to
+ reduce the call frequency of the costly fil_validate() check
+ in debug builds. */
+ if (--fil_validate_count > 0) {
+ return(TRUE);
+ }
+
+ fil_validate_count = FIL_VALIDATE_SKIP;
+ return(fil_validate());
+}
+#endif /* UNIV_DEBUG */
/********************************************************************//**
NOTE: you must call fil_mutex_enter_and_prepare_for_io() first!
@@ -4307,7 +4335,7 @@ fil_io(
#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
#endif
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
#ifndef UNIV_HOTBACKUP
# ifndef UNIV_LOG_DEBUG
/* ibuf bitmap pages must be read in the sync aio mode: */
@@ -4466,7 +4494,7 @@ fil_io(
mutex_exit(&fil_system->mutex);
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
}
return(DB_SUCCESS);
@@ -4490,7 +4518,7 @@ fil_aio_wait(
void* message;
ulint type;
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
if (srv_use_native_aio) {
srv_set_io_thread_op_info(segment, "native aio handle");
@@ -4521,7 +4549,7 @@ fil_aio_wait(
mutex_exit(&fil_system->mutex);
- ut_ad(fil_validate());
+ ut_ad(fil_validate_skip());
/* Do the i/o handling */
/* IMPORTANT: since i/o handling for reads will read also the insert