summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2016-03-17 15:12:57 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2016-03-21 11:48:04 +0100
commite8af217e16837000b8a3809e9fa48a5e75088cd0 (patch)
tree6077f93d8334b027c46f0967ad7ffa73eae24a89 /sql/sql_admin.cc
parent94768542115289272996f6450b7d3cafa75dcead (diff)
downloadmariadb-git-e8af217e16837000b8a3809e9fa48a5e75088cd0.tar.gz
MDEV-9590: Always print "Engine-independent statistic" warnings and might be filtering columns unintentionally from engines
Do not issue the warning in case we are not going to collect the statistics.
Diffstat (limited to 'sql/sql_admin.cc')
-rw-r--r--sql/sql_admin.cc94
1 files changed, 51 insertions, 43 deletions
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 8b58f062a3e..f27cdcc41f2 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -369,6 +369,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
char* db = table->db;
bool fatal_error=0;
bool open_error;
+ bool collect_eis= FALSE;
DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name));
strxmov(table_name, db, ".", table->table_name, NullS);
@@ -697,53 +698,64 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
{
compl_result_code= result_code= HA_ADMIN_INVALID;
}
+ collect_eis=
+ (table->table->s->table_category == TABLE_CATEGORY_USER &&
+ (get_use_stat_tables_mode(thd) > NEVER ||
+ lex->with_persistent_for_clause));
- if (!lex->column_list)
+ if (collect_eis)
{
- bitmap_clear_all(tab->read_set);
- for (uint fields= 0; *field_ptr; field_ptr++, fields++)
+ if (!lex->column_list)
{
- enum enum_field_types type= (*field_ptr)->type();
- if (type < MYSQL_TYPE_MEDIUM_BLOB ||
- type > MYSQL_TYPE_BLOB)
- bitmap_set_bit(tab->read_set, fields);
- else
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_NO_EIS_FOR_FIELD,
- ER_THD(thd, ER_NO_EIS_FOR_FIELD),
- (*field_ptr)->field_name);
+ bitmap_clear_all(tab->read_set);
+ for (uint fields= 0; *field_ptr; field_ptr++, fields++)
+ {
+ enum enum_field_types type= (*field_ptr)->type();
+ if (type < MYSQL_TYPE_MEDIUM_BLOB ||
+ type > MYSQL_TYPE_BLOB)
+ bitmap_set_bit(tab->read_set, fields);
+ else if (collect_eis)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_NO_EIS_FOR_FIELD,
+ ER_THD(thd, ER_NO_EIS_FOR_FIELD),
+ (*field_ptr)->field_name);
+ }
}
- }
- else
- {
- int pos;
- LEX_STRING *column_name;
- List_iterator_fast<LEX_STRING> it(*lex->column_list);
+ else
+ {
+ int pos;
+ LEX_STRING *column_name;
+ List_iterator_fast<LEX_STRING> it(*lex->column_list);
- bitmap_clear_all(tab->read_set);
- while ((column_name= it++))
- {
- if (tab->s->fieldnames.type_names == 0 ||
- (pos= find_type(&tab->s->fieldnames, column_name->str,
- column_name->length, 1)) <= 0)
+ bitmap_clear_all(tab->read_set);
+ while ((column_name= it++))
{
- compl_result_code= result_code= HA_ADMIN_INVALID;
- break;
+ if (tab->s->fieldnames.type_names == 0 ||
+ (pos= find_type(&tab->s->fieldnames, column_name->str,
+ column_name->length, 1)) <= 0)
+ {
+ compl_result_code= result_code= HA_ADMIN_INVALID;
+ break;
+ }
+ pos--;
+ enum enum_field_types type= tab->field[pos]->type();
+ if (type < MYSQL_TYPE_MEDIUM_BLOB ||
+ type > MYSQL_TYPE_BLOB)
+ bitmap_set_bit(tab->read_set, pos);
+ else if (collect_eis)
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_NO_EIS_FOR_FIELD,
+ ER_THD(thd, ER_NO_EIS_FOR_FIELD),
+ column_name->str);
}
- pos--;
- enum enum_field_types type= tab->field[pos]->type();
- if (type < MYSQL_TYPE_MEDIUM_BLOB ||
- type > MYSQL_TYPE_BLOB)
- bitmap_set_bit(tab->read_set, pos);
- else
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- ER_NO_EIS_FOR_FIELD,
- ER_THD(thd, ER_NO_EIS_FOR_FIELD),
- column_name->str);
+ tab->file->column_bitmaps_signal();
}
- tab->file->column_bitmaps_signal();
}
-
+ else
+ {
+ DBUG_ASSERT(!lex->column_list);
+ }
+
if (!lex->index_list)
{
tab->keys_in_use_for_query.init(tab->s->keys);
@@ -778,11 +790,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
}
- if (compl_result_code == HA_ADMIN_OK &&
- operator_func == &handler::ha_analyze &&
- table->table->s->table_category == TABLE_CATEGORY_USER &&
- (get_use_stat_tables_mode(thd) > NEVER ||
- lex->with_persistent_for_clause))
+ if (compl_result_code == HA_ADMIN_OK && collect_eis)
{
if (!(compl_result_code=
alloc_statistics_for_table(thd, table->table)) &&