summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-10-30 23:38:05 +0100
committerSergei Golubchik <serg@mariadb.org>2019-10-30 23:38:05 +0100
commitfd6dfb3b54bdfb85b2d48bbe1a2ddabb2da7401b (patch)
tree9bf1a1831e8acc154c2bb781f1e5b8f1bbe47df4 /sql/sql_statistics.cc
parent6680b049618f8780fa4800a83553fd1ba88f905b (diff)
parent313855766f3ce608001d686553ef6e087a70d264 (diff)
downloadmariadb-git-fd6dfb3b54bdfb85b2d48bbe1a2ddabb2da7401b.tar.gz
Merge branch 'github/10.1' into 10.2
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index ac471c6894d..f8723a4f8ee 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -258,10 +258,8 @@ index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col};
Open all statistical tables and lock them
*/
-static
-inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
- Open_tables_backup *backup,
- bool for_write)
+static int open_stat_tables(THD *thd, TABLE_LIST *tables,
+ Open_tables_backup *backup, bool for_write)
{
int rc;
@@ -269,12 +267,14 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
thd->push_internal_handler(&deh);
init_table_list_for_stat_tables(tables, for_write);
init_mdl_requests(tables);
+ thd->in_sub_stmt|= SUB_STMT_STAT_TABLES;
rc= open_system_tables_for_read(thd, tables, backup);
+ thd->in_sub_stmt&= ~SUB_STMT_STAT_TABLES;
thd->pop_internal_handler();
/* If the number of tables changes, we should revise the check below. */
- DBUG_ASSERT(STATISTICS_TABLES == 3);
+ compile_time_assert(STATISTICS_TABLES == 3);
if (!rc &&
(stat_table_intact.check(tables[TABLE_STAT].table, &table_stat_def) ||
@@ -3276,10 +3276,7 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables)
DBUG_RETURN(0);
if (open_stat_tables(thd, stat_tables, &open_tables_backup, FALSE))
- {
- thd->clear_error();
DBUG_RETURN(1);
- }
for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
{