Commit 3ae21984 authored by Aakanksha Verma's avatar Aakanksha Verma Committed by Marko Mäkelä

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<bin.x.su@oracle.com>
RB: 21277
parent bb17094b
/*****************************************************************************
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;
......
/*****************************************************************************
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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment