Commit e8af217e authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-9590: Always print "Engine-independent statistic" warnings and might be...

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.
parent 94768542
...@@ -34,11 +34,9 @@ create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_g ...@@ -34,11 +34,9 @@ create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_g
insert into t1 values ('hello'); insert into t1 values ('hello');
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
test.t1 analyze status OK test.t1 analyze status OK
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze Warning Engine-independent statistics are not collected for column 'a'
test.t1 analyze status Table is already up to date test.t1 analyze status Table is already up to date
drop table t1; drop table t1;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
......
...@@ -7,34 +7,19 @@ mtr.test_suppressions OK ...@@ -7,34 +7,19 @@ mtr.test_suppressions OK
mysql.column_stats OK mysql.column_stats OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event mysql.event OK
Warning : Engine-independent statistics are not collected for column 'body'
Warning : Engine-independent statistics are not collected for column 'body_utf8'
status : OK
mysql.func OK mysql.func OK
mysql.gtid_slave_pos OK mysql.gtid_slave_pos OK
mysql.help_category mysql.help_category OK
Warning : Engine-independent statistics are not collected for column 'url'
status : OK
mysql.help_keyword OK mysql.help_keyword OK
mysql.help_relation OK mysql.help_relation OK
mysql.help_topic mysql.help_topic OK
Warning : Engine-independent statistics are not collected for column 'description'
Warning : Engine-independent statistics are not collected for column 'example'
Warning : Engine-independent statistics are not collected for column 'url'
status : OK
mysql.host OK mysql.host OK
mysql.index_stats OK mysql.index_stats OK
mysql.innodb_index_stats OK mysql.innodb_index_stats OK
mysql.innodb_table_stats OK mysql.innodb_table_stats OK
mysql.plugin OK mysql.plugin OK
mysql.proc mysql.proc OK
Warning : Engine-independent statistics are not collected for column 'param_list'
Warning : Engine-independent statistics are not collected for column 'returns'
Warning : Engine-independent statistics are not collected for column 'body'
Warning : Engine-independent statistics are not collected for column 'comment'
Warning : Engine-independent statistics are not collected for column 'body_utf8'
status : OK
mysql.procs_priv OK mysql.procs_priv OK
mysql.proxies_priv OK mysql.proxies_priv OK
mysql.roles_mapping OK mysql.roles_mapping OK
...@@ -46,12 +31,7 @@ mysql.time_zone_leap_second OK ...@@ -46,12 +31,7 @@ mysql.time_zone_leap_second OK
mysql.time_zone_name OK mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.user mysql.user OK
Warning : Engine-independent statistics are not collected for column 'ssl_cipher'
Warning : Engine-independent statistics are not collected for column 'x509_issuer'
Warning : Engine-independent statistics are not collected for column 'x509_subject'
Warning : Engine-independent statistics are not collected for column 'authentication_string'
status : OK
mtr.global_suppressions Table is already up to date mtr.global_suppressions Table is already up to date
mtr.test_suppressions Table is already up to date mtr.test_suppressions Table is already up to date
mysql.column_stats OK mysql.column_stats OK
...@@ -89,34 +69,19 @@ mysql.user OK ...@@ -89,34 +69,19 @@ mysql.user OK
mysql.column_stats OK mysql.column_stats OK
mysql.columns_priv OK mysql.columns_priv OK
mysql.db OK mysql.db OK
mysql.event mysql.event OK
Warning : Engine-independent statistics are not collected for column 'body'
Warning : Engine-independent statistics are not collected for column 'body_utf8'
status : OK
mysql.func OK mysql.func OK
mysql.gtid_slave_pos OK mysql.gtid_slave_pos OK
mysql.help_category mysql.help_category OK
Warning : Engine-independent statistics are not collected for column 'url'
status : OK
mysql.help_keyword OK mysql.help_keyword OK
mysql.help_relation OK mysql.help_relation OK
mysql.help_topic mysql.help_topic OK
Warning : Engine-independent statistics are not collected for column 'description'
Warning : Engine-independent statistics are not collected for column 'example'
Warning : Engine-independent statistics are not collected for column 'url'
status : OK
mysql.host OK mysql.host OK
mysql.index_stats OK mysql.index_stats OK
mysql.innodb_index_stats OK mysql.innodb_index_stats OK
mysql.innodb_table_stats OK mysql.innodb_table_stats OK
mysql.plugin OK mysql.plugin OK
mysql.proc mysql.proc OK
Warning : Engine-independent statistics are not collected for column 'param_list'
Warning : Engine-independent statistics are not collected for column 'returns'
Warning : Engine-independent statistics are not collected for column 'body'
Warning : Engine-independent statistics are not collected for column 'comment'
Warning : Engine-independent statistics are not collected for column 'body_utf8'
status : OK
mysql.procs_priv OK mysql.procs_priv OK
mysql.proxies_priv OK mysql.proxies_priv OK
mysql.roles_mapping OK mysql.roles_mapping OK
...@@ -128,12 +93,7 @@ mysql.time_zone_leap_second OK ...@@ -128,12 +93,7 @@ mysql.time_zone_leap_second OK
mysql.time_zone_name OK mysql.time_zone_name OK
mysql.time_zone_transition OK mysql.time_zone_transition OK
mysql.time_zone_transition_type OK mysql.time_zone_transition_type OK
mysql.user mysql.user OK
Warning : Engine-independent statistics are not collected for column 'ssl_cipher'
Warning : Engine-independent statistics are not collected for column 'x509_issuer'
Warning : Engine-independent statistics are not collected for column 'x509_subject'
Warning : Engine-independent statistics are not collected for column 'authentication_string'
status : OK
mysql.column_stats Table is already up to date mysql.column_stats Table is already up to date
mysql.columns_priv Table is already up to date mysql.columns_priv Table is already up to date
mysql.db Table is already up to date mysql.db Table is already up to date
......
...@@ -1663,3 +1663,17 @@ FROM mysql.column_stats; ...@@ -1663,3 +1663,17 @@ FROM mysql.column_stats;
db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_frequency hist_size hist_type HEX(histogram) db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_frequency hist_size hist_type HEX(histogram)
test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL
drop table t1; drop table t1;
#
# MDEV-9590: Always print "Engine-independent statistic" warnings and
# might be filtering columns unintentionally from engines
#
set use_stat_tables='NEVER';
create table t1 (test blob);
show variables like 'use_stat_tables';
Variable_name Value
use_stat_tables NEVER
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
drop table t1;
set use_stat_tables=@save_use_stat_tables;
...@@ -36,7 +36,6 @@ count ...@@ -36,7 +36,6 @@ count
2 2
ANALYZE TABLE articles; ANALYZE TABLE articles;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
test.articles analyze status OK test.articles analyze status OK
SELECT * FROM articles WHERE MATCH (title,body) SELECT * FROM articles WHERE MATCH (title,body)
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
......
...@@ -247,7 +247,6 @@ articles CREATE TABLE `articles` ( ...@@ -247,7 +247,6 @@ articles CREATE TABLE `articles` (
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
ANALYZE TABLE articles; ANALYZE TABLE articles;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
test.articles analyze status OK test.articles analyze status OK
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
id title body id title body
...@@ -570,7 +569,6 @@ select @@innodb_ft_enable_stopword; ...@@ -570,7 +569,6 @@ select @@innodb_ft_enable_stopword;
1 1
ANALYZE TABLE articles; ANALYZE TABLE articles;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
test.articles analyze status OK test.articles analyze status OK
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
id title body id title body
......
...@@ -122,11 +122,9 @@ a left(b,40) ...@@ -122,11 +122,9 @@ a left(b,40)
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA 1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysqltest_innodb_zip.t1 analyze Warning Engine-independent statistics are not collected for column 'b'
mysqltest_innodb_zip.t1 analyze status OK mysqltest_innodb_zip.t1 analyze status OK
analyze table t2; analyze table t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysqltest_innodb_zip.t2 analyze Warning Engine-independent statistics are not collected for column 'b'
mysqltest_innodb_zip.t2 analyze status OK mysqltest_innodb_zip.t2 analyze status OK
SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'; SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format data_length index_length table_schema table_name row_format data_length index_length
......
...@@ -322,7 +322,6 @@ FLUSH TABLES; ...@@ -322,7 +322,6 @@ FLUSH TABLES;
# replacing p6 with a crashed MYD file (1) (splitted dynamic record) # replacing p6 with a crashed MYD file (1) (splitted dynamic record)
ANALYZE TABLE t1_will_crash; ANALYZE TABLE t1_will_crash;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1_will_crash analyze Warning Engine-independent statistics are not collected for column 'c'
test.t1_will_crash analyze status OK test.t1_will_crash analyze status OK
OPTIMIZE TABLE t1_will_crash; OPTIMIZE TABLE t1_will_crash;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
......
...@@ -728,3 +728,16 @@ select db_name, table_name, column_name, ...@@ -728,3 +728,16 @@ select db_name, table_name, column_name,
FROM mysql.column_stats; FROM mysql.column_stats;
drop table t1; drop table t1;
--echo #
--echo # MDEV-9590: Always print "Engine-independent statistic" warnings and
--echo # might be filtering columns unintentionally from engines
--echo #
set use_stat_tables='NEVER';
create table t1 (test blob);
show variables like 'use_stat_tables';
analyze table t1;
drop table t1;
set use_stat_tables=@save_use_stat_tables;
...@@ -369,6 +369,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -369,6 +369,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
char* db = table->db; char* db = table->db;
bool fatal_error=0; bool fatal_error=0;
bool open_error; bool open_error;
bool collect_eis= FALSE;
DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name)); DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name));
strxmov(table_name, db, ".", table->table_name, NullS); strxmov(table_name, db, ".", table->table_name, NullS);
...@@ -697,53 +698,64 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -697,53 +698,64 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
{ {
compl_result_code= result_code= HA_ADMIN_INVALID; 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); if (!lex->column_list)
for (uint fields= 0; *field_ptr; field_ptr++, fields++)
{ {
enum enum_field_types type= (*field_ptr)->type(); bitmap_clear_all(tab->read_set);
if (type < MYSQL_TYPE_MEDIUM_BLOB || for (uint fields= 0; *field_ptr; field_ptr++, fields++)
type > MYSQL_TYPE_BLOB) {
bitmap_set_bit(tab->read_set, fields); enum enum_field_types type= (*field_ptr)->type();
else if (type < MYSQL_TYPE_MEDIUM_BLOB ||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, type > MYSQL_TYPE_BLOB)
ER_NO_EIS_FOR_FIELD, bitmap_set_bit(tab->read_set, fields);
ER_THD(thd, ER_NO_EIS_FOR_FIELD), else if (collect_eis)
(*field_ptr)->field_name); 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
else {
{ int pos;
int pos; LEX_STRING *column_name;
LEX_STRING *column_name; List_iterator_fast<LEX_STRING> it(*lex->column_list);
List_iterator_fast<LEX_STRING> it(*lex->column_list);
bitmap_clear_all(tab->read_set); bitmap_clear_all(tab->read_set);
while ((column_name= it++)) 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)
{ {
compl_result_code= result_code= HA_ADMIN_INVALID; if (tab->s->fieldnames.type_names == 0 ||
break; (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--; tab->file->column_bitmaps_signal();
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();
} }
else
{
DBUG_ASSERT(!lex->column_list);
}
if (!lex->index_list) if (!lex->index_list)
{ {
tab->keys_in_use_for_query.init(tab->s->keys); tab->keys_in_use_for_query.init(tab->s->keys);
...@@ -778,11 +790,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -778,11 +790,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_PRINT("admin", ("operator_func returned: %d", result_code)); DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
} }
if (compl_result_code == HA_ADMIN_OK && if (compl_result_code == HA_ADMIN_OK && collect_eis)
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= if (!(compl_result_code=
alloc_statistics_for_table(thd, table->table)) && alloc_statistics_for_table(thd, table->table)) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment