From 5116c09f84c4d65deee40040894132046b053c48 Mon Sep 17 00:00:00 2001 From: Alessandro Vetere Date: Thu, 10 Sep 2026 11:44:29 +0200 Subject: [PATCH] Fix the build with cmake -DWITH_INNODB_AHI=OFF Without BTR_CUR_HASH_ADAPT, buf_block_t::index, btr_search and innodb_adaptive_hash_index_cells do not exist, so the assertion in buf_LRU_truncate_temp() and the derivation of btr_search.n_cells in innodb_init_params() are compiled only with it. mysql-test/collections/broken-no-innodb-ahi.list names the tests that fail in such a build, for --skip-test-list. They need the adaptive hash index variables or counters, or the IS_HASHED column of INFORMATION_SCHEMA.INNODB_BUFFER_PAGE and INNODB_BUFFER_PAGE_LRU, which the build omits together with the sys schema views that read it. --- .../collections/broken-no-innodb-ahi.list | 54 +++++++++++++++++++ storage/innobase/buf/buf0lru.cc | 2 + storage/innobase/handler/ha_innodb.cc | 2 + 3 files changed, 58 insertions(+) create mode 100644 mysql-test/collections/broken-no-innodb-ahi.list diff --git a/mysql-test/collections/broken-no-innodb-ahi.list b/mysql-test/collections/broken-no-innodb-ahi.list new file mode 100644 index 00000000000..b62883d2401 --- /dev/null +++ b/mysql-test/collections/broken-no-innodb-ahi.list @@ -0,0 +1,54 @@ +# Tests that fail in a build with cmake -DWITH_INNODB_AHI=OFF. Pass this +# file to mariadb-test-run.pl with --skip-test-list for such a build. +# +# Without the adaptive hash index, its system variables and its +# INFORMATION_SCHEMA.INNODB_METRICS counters do not exist, and +# INFORMATION_SCHEMA.INNODB_BUFFER_PAGE and INNODB_BUFFER_PAGE_LRU have no +# IS_HASHED column. The sys schema views innodb_buffer_stats_by_schema, +# innodb_buffer_stats_by_table and schema_table_statistics_with_buffer read +# that column, so they are not created. +# +# A test marked "only turns the adaptive hash index off" tests nothing of it, +# and can run in such a build once it changes the setting only where the +# setting exists. +encryption.innochecksum : needs the adaptive hash index +innodb.import_bugs : needs the adaptive hash index +innodb.innodb_buffer_pool_resize : needs the adaptive hash index +innodb.innodb_buffer_pool_resize_temporary : needs the adaptive hash index +innodb.insert_into_empty : needs the adaptive hash index +innodb.msan_failure : needs the adaptive hash index +innodb.monitor : needs the adaptive hash index counters +innodb.innodb_skip_innodb_is_tables : needs the adaptive hash index counters +sys_vars.innodb_adaptive_hash_index_basic : needs the adaptive hash index +sys_vars.innodb_adaptive_hash_index_parts_basic : needs the adaptive hash index +sys_vars.sysvars_innodb : lists the adaptive hash index variables +innodb.lock_memory : only turns the adaptive hash index off +innodb.innodb_bug30113362 : only turns the adaptive hash index off +main.rowid_filter_innodb : its normal combination only turns the adaptive hash index off +main.ctype_upgrade : no IS_HASHED without the adaptive hash index +main.information_schema : no IS_HASHED without the adaptive hash index +main.log_tables_upgrade : no IS_HASHED without the adaptive hash index +main.lowercase_fs_off : no IS_HASHED without the adaptive hash index +main.mysql_upgrade : no IS_HASHED without the adaptive hash index +main.mysql_upgrade-20228 : no IS_HASHED without the adaptive hash index +main.mysql_upgrade-28915 : no IS_HASHED without the adaptive hash index +main.mysql_upgrade-34014 : no IS_HASHED without the adaptive hash index +main.mysql_upgrade-6984 : no IS_HASHED without the adaptive hash index +main.mysql_upgrade_mysql_json : no IS_HASHED without the adaptive hash index +main.mysql_upgrade_mysql_json_datatype : no IS_HASHED without the adaptive hash index +main.mysql_upgrade_mysql_json_with_plugin_loaded : no IS_HASHED without the adaptive hash index +main.mysql_upgrade_ssl : no IS_HASHED without the adaptive hash index +main.mysql_upgrade_view : no IS_HASHED without the adaptive hash index +main.sp-group : no IS_HASHED without the adaptive hash index +main.upgrade_MDEV-19650 : no IS_HASHED without the adaptive hash index +main.upgrade_MDEV-23102-1 : no IS_HASHED without the adaptive hash index +main.upgrade_MDEV-23102-2 : no IS_HASHED without the adaptive hash index +main.upgrade_geometrycolumn_procedure_definer : no IS_HASHED without the adaptive hash index +main.upgrade_mdev_24363 : no IS_HASHED without the adaptive hash index +innodb.innodb_information_schema_buffer : no IS_HASHED without the adaptive hash index +innodb_i_s.innodb_buffer_page : no IS_HASHED without the adaptive hash index +innodb_i_s.innodb_buffer_page_lru : no IS_HASHED without the adaptive hash index +sysschema.all_sys_objects_exist : no IS_HASHED without the adaptive hash index +sysschema.v_innodb_buffer_stats_by_schema : no IS_HASHED without the adaptive hash index +sysschema.v_innodb_buffer_stats_by_table : no IS_HASHED without the adaptive hash index +sysschema.v_schema_table_statistics_with_buffer : no IS_HASHED without the adaptive hash index diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 2b7bf5c9297..5c76621c9e7 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1304,7 +1304,9 @@ void buf_LRU_truncate_temp(uint32_t threshold) bpage->lock.u_unlock(); } #endif /* UNIV_DEBUG */ +#ifdef BTR_CUR_HASH_ADAPT ut_ad(!reinterpret_cast(bpage)->index); +#endif buf_LRU_free_page(bpage, true); } bpage= next; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6ef20f3064a..25b5cd4a3ee 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3865,6 +3865,7 @@ static int innodb_init_params() DBUG_RETURN(HA_ERR_INITIALIZATION); } +#ifdef BTR_CUR_HASH_ADAPT if (btr_search.n_cells <= MYSQL_SYSVAR_NAME(adaptive_hash_index_cells).min_val) { @@ -3877,6 +3878,7 @@ static int innodb_init_params() btr_search.n_cells= std::max(MYSQL_SYSVAR_NAME(adaptive_hash_index_cells).min_val, uint(n)); } +#endif /* BTR_CUR_HASH_ADAPT */ if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG))