Skip to content
Permalink
Browse files
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
  • Loading branch information
Aakanksha Verma authored and dr-m committed Apr 25, 2019
1 parent bb17094 commit 3ae2198
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
@@ -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;
@@ -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));

0 comments on commit 3ae2198

Please sign in to comment.