summaryrefslogtreecommitdiff
path: root/storage/innobase/ha
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-02-23 23:05:12 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-03 16:55:50 +0200
commit27b9989d316163d00177bfee8fceb10995c2ba9b (patch)
treeb30f3170e4ab4b70019bb89e8172d1c46b2b2210 /storage/innobase/ha
parent545f49dac361aa80aea26625233f9856ef4e16f5 (diff)
downloadmariadb-git-27b9989d316163d00177bfee8fceb10995c2ba9b.tar.gz
MDEV-12121 Introduce build option WITH_INNODB_AHI to disable innodb_adaptive_hash_index
The InnoDB adaptive hash index is sometimes degrading the performance of InnoDB, and it is sometimes disabled to get more consistent performance. We should have a compile-time option to disable the adaptive hash index. Let us introduce two options: OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON) OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON) where WITH_INNODB_AHI always implies WITH_INNODB_ROOT_GUESS. As part of this change, the misleadingly named function trx_search_latch_release_if_reserved(trx) will be replaced with the macro trx_assert_no_search_latch(trx) that will be empty unless BTR_CUR_HASH_ADAPT is defined (cmake -DWITH_INNODB_AHI=ON). We will also remove the unused column INFORMATION_SCHEMA.INNODB_TRX.TRX_ADAPTIVE_HASH_TIMEOUT. In MariaDB Server 10.1, it used to reflect the value of trx_t::search_latch_timeout which could be adjusted during row_search_for_mysql(). In 10.2, there is no such field. Other than the removal of the unused column TRX_ADAPTIVE_HASH_TIMEOUT, this is an almost non-functional change to the server when using the default build options. Some tests are adjusted so that they will work with both -DWITH_INNODB_AHI=ON and -DWITH_INNODB_AHI=OFF. The test innodb.innodb_monitor has been renamed to innodb.monitor in order to track MySQL 5.7, and the duplicate tests sys_vars.innodb_monitor_* are removed.
Diffstat (limited to 'storage/innobase/ha')
-rw-r--r--storage/innobase/ha/ha0ha.cc4
-rw-r--r--storage/innobase/ha/hash0hash.cc6
2 files changed, 8 insertions, 2 deletions
diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc
index cf92f22ac15..1f90738c75f 100644
--- a/storage/innobase/ha/ha0ha.cc
+++ b/storage/innobase/ha/ha0ha.cc
@@ -146,7 +146,9 @@ ha_clear(
hash_table_t* table) /*!< in, own: hash table */
{
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
+#ifdef BTR_CUR_HASH_ADAPT
ut_ad(!table->adaptive || btr_search_own_all(RW_LOCK_X));
+#endif /* BTR_CUR_HASH_ADAPT */
for (ulint i = 0; i < table->n_sync_obj; i++) {
mem_heap_free(table->heaps[i]);
@@ -189,6 +191,7 @@ ha_clear(
}
}
+#ifdef BTR_CUR_HASH_ADAPT
/*************************************************************//**
Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node
@@ -536,3 +539,4 @@ builds, see http://bugs.mysql.com/36941 */
(ulong) n_bufs);
}
}
+#endif /* BTR_CUR_HASH_ADAPT */
diff --git a/storage/innobase/ha/hash0hash.cc b/storage/innobase/ha/hash0hash.cc
index 7c5798ae254..ef1339ff47b 100644
--- a/storage/innobase/ha/hash0hash.cc
+++ b/storage/innobase/ha/hash0hash.cc
@@ -273,9 +273,11 @@ hash_create(
table->type = HASH_TABLE_SYNC_NONE;
table->array = array;
table->n_cells = prime;
-#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+#ifdef BTR_CUR_HASH_ADAPT
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
table->adaptive = FALSE;
-#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+#endif /* BTR_CUR_HASH_ADAPT */
table->n_sync_obj = 0;
table->sync_obj.mutexes = NULL;
table->heaps = NULL;