summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-05-01 01:44:45 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-05-02 01:02:56 +0530
commitca94ce2a5817cec6d402b6c92653330825e0a2bf (patch)
treec056d8bd685cdad2989b6b58afb46d337afa4a01 /sql/sql_statistics.cc
parent57c37e6c3ffc69c9a682601bd0c2e286b4743876 (diff)
downloadmariadb-git-ca94ce2a5817cec6d402b6c92653330825e0a2bf.tar.gz
MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema
To read histograms for a table, we should check if the allocation of statistics was done or not, if not done we should not try to read histograms for such a table.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 061622a2cd6..8dc78e0327e 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3285,12 +3285,13 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
if (table_share->stats_cb.stats_is_read)
tl->table->stats_is_read= TRUE;
if (thd->variables.optimizer_use_condition_selectivity > 3 &&
- table_share && !table_share->stats_cb.histograms_are_read)
+ table_share && table_share->stats_cb.stats_can_be_read &&
+ !table_share->stats_cb.histograms_are_read)
{
(void) read_histograms_for_table(thd, tl->table, stat_tables);
table_share->stats_cb.histograms_are_read= TRUE;
}
- if (table_share->stats_cb.stats_is_read)
+ if (table_share->stats_cb.histograms_are_read)
tl->table->histograms_are_read= TRUE;
}
}