From 3ae219848322dea1e42b9ba25e3066bbc9aa217d Mon Sep 17 00:00:00 2001 From: Aakanksha Verma Date: Wed, 30 Jan 2019 23:09:57 +0530 Subject: Bug #19811005 ALTER TABLE ADD INDEX DOES NOT UPDATE INDEX_LENGTH IN I_S TABLES PROBLEM ======= An add index doesn't update index length stats in information schema TABLES table. FIX === Update the dict_table_t variable with index length stats that is actually calculated post alter . As this variable is used to populated the information schema index length statistics. Reviewed by: Bin su RB: 21277 --- storage/innobase/dict/dict0stats.cc | 5 +++-- storage/xtradb/dict/dict0stats.cc | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 364add4791d..06364689173 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -2499,7 +2499,6 @@ dict_stats_report_error( return (err); } - /** Save the table's statistics into the persistent statistics storage. @param[in] table_orig table whose stats to save @param[in] only_for_index if this is non-NULL, then stats for indexes @@ -3208,6 +3207,8 @@ dict_stats_update_for_index( if (dict_stats_persistent_storage_check(false)) { dict_table_stats_lock(index->table, RW_X_LATCH); dict_stats_analyze_index(index); + index->table->stat_sum_of_other_index_sizes + += index->stat_index_size; dict_table_stats_unlock(index->table, RW_X_LATCH); dict_stats_save(index->table, &index->id); DBUG_VOID_RETURN; diff --git a/storage/xtradb/dict/dict0stats.cc b/storage/xtradb/dict/dict0stats.cc index c1463e98ce0..06364689173 100644 --- a/storage/xtradb/dict/dict0stats.cc +++ b/storage/xtradb/dict/dict0stats.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -3207,6 +3207,8 @@ dict_stats_update_for_index( if (dict_stats_persistent_storage_check(false)) { dict_table_stats_lock(index->table, RW_X_LATCH); dict_stats_analyze_index(index); + index->table->stat_sum_of_other_index_sizes + += index->stat_index_size; dict_table_stats_unlock(index->table, RW_X_LATCH); dict_stats_save(index->table, &index->id); DBUG_VOID_RETURN; @@ -4006,7 +4008,6 @@ dict_stats_save_defrag_stats( { dberr_t ret; - if (index->is_readable()) { } else { return (dict_stats_report_error(index->table, true)); -- cgit v1.2.1