summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2016-06-20 09:58:31 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2016-06-20 09:58:31 +0300
commit70ad689b11bfbd8a30a777f4893a5384628c00e7 (patch)
tree68c8ff4244b6c6bd7f4e01dc20ce3f129f76d01f /sql/sql_statistics.cc
parente24a1833701d358b98d294716c2c1d24850bf982 (diff)
downloadmariadb-git-70ad689b11bfbd8a30a777f4893a5384628c00e7.tar.gz
MDEV-8633: information_schema.index_statistics doesn't delete
item when drop table indexes or drop table; Problem was that table and index statistics is removed from persistent tables but not from memory cache. Added functions to remove table and index statistics from memory cache.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index e86c84040b4..47a5a40ebeb 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -29,6 +29,7 @@
#include "sql_statistics.h"
#include "opt_range.h"
#include "my_atomic.h"
+#include "sql_show.h"
/*
The system variable 'use_stat_tables' can take one of the
@@ -3193,6 +3194,10 @@ int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab)
rc= 1;
}
+ err= del_global_table_stat(thd, db, tab);
+ if (err & !rc)
+ rc= 1;
+
thd->restore_stmt_binlog_format(save_binlog_format);
close_system_tables(thd, &open_tables_backup);
@@ -3339,6 +3344,10 @@ int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info,
}
}
+ err= del_global_index_stat(thd, tab, key_info);
+ if (err && !rc)
+ rc= 1;
+
thd->restore_stmt_binlog_format(save_binlog_format);
close_system_tables(thd, &open_tables_backup);