From 25faeff92e1d30ffcc50a9472a23736b0f62d006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 23 Apr 2021 18:58:59 +0300 Subject: MDEV-23026 fixup --- storage/innobase/handler/ha_innodb.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 71dc310501d..66d2ad43453 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6195,16 +6195,6 @@ ha_innobase::open(const char* name, int, uint) innobase_copy_frm_flags_from_table_share(ib_table, table->s); - const bool bk_thread = THDVAR(thd, background_thread); - /* No point to init any statistics if tablespace is still encrypted - or if table is being opened by background thread */ - if (bk_thread) { - } else if (ib_table->is_readable()) { - dict_stats_init(ib_table); - } else { - ib_table->stat_initialized = 1; - } - MONITOR_INC(MONITOR_TABLE_OPEN); if ((ib_table->flags2 & DICT_TF2_DISCARDED)) { @@ -6400,7 +6390,7 @@ ha_innobase::open(const char* name, int, uint) ut_ad(!m_prebuilt->table || table->versioned() == m_prebuilt->table->versioned()); - if (!bk_thread) { + if (!THDVAR(thd, background_thread)) { info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_OPEN); } @@ -14251,6 +14241,10 @@ ha_innobase::info_low( ib_table = m_prebuilt->table; DBUG_ASSERT(ib_table->get_ref_count() > 0); + if (!ib_table->is_readable()) { + ib_table->stat_initialized = true; + } + if (flag & HA_STATUS_TIME) { if (is_analyze || innobase_stats_on_metadata) { @@ -14303,6 +14297,8 @@ ha_innobase::info_low( DBUG_EXECUTE_IF("dict_sys_mutex_avoid", goto func_exit;); + dict_stats_init(ib_table); + if (flag & HA_STATUS_VARIABLE) { ulint stat_clustered_index_size; -- cgit v1.2.1