From fb96ac0a496f0665b3feca3cf85aeeedf4bd1e23 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 21 Apr 2021 21:12:33 +0530 Subject: MDEV-25474 Background thread returns uninitialized statistics to mysql interpreter InnoDB returns uninitialized statistics to mysql interpreter when background thread is opening the table. So it leads to assertion failure. In that case, InnoDB avoid sending innodb statistics information to mysql interpreter. --- storage/innobase/handler/ha_innodb.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b837aec396b..c95e6646968 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6261,9 +6261,10 @@ no_such_table: 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 (THDVAR(thd, background_thread)) { + if (bk_thread) { } else if (ib_table->is_readable()) { dict_stats_init(ib_table); } else { @@ -6515,7 +6516,10 @@ no_such_table: } } - info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + if (!bk_thread) { + info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST); + } + DBUG_RETURN(0); } -- cgit v1.2.1