1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Backporting 273d8eb12c Proper fix for disabling warnings in read_statistics_for_table()

This commit is contained in:
Varun Gupta
2019-09-23 13:47:52 +05:30
parent 2931fd2917
commit ab9f378b0b
12 changed files with 85 additions and 186 deletions

View File

@ -1044,6 +1044,9 @@ public:
{
char buff[MAX_FIELD_WIDTH];
String val(buff, sizeof(buff), &my_charset_bin);
my_bitmap_map *old_map;
old_map= dbug_tmp_use_all_columns(stat_table, stat_table->read_set);
for (uint i= COLUMN_STAT_MIN_VALUE; i <= COLUMN_STAT_HISTOGRAM; i++)
{
@ -1102,6 +1105,7 @@ public:
}
}
}
dbug_tmp_restore_column_map(stat_table->read_set, old_map);
}
@ -1153,14 +1157,12 @@ public:
case COLUMN_STAT_MIN_VALUE:
table_field->read_stats->min_value->set_notnull();
stat_field->val_str(&val);
DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field);
table_field->read_stats->min_value->store(val.ptr(), val.length(),
&my_charset_bin);
break;
case COLUMN_STAT_MAX_VALUE:
table_field->read_stats->max_value->set_notnull();
stat_field->val_str(&val);
DBUG_ASSERT(table_field->read_stats->min_value->is_stat_field);
table_field->read_stats->max_value->store(val.ptr(), val.length(),
&my_charset_bin);
break;
@ -1980,7 +1982,7 @@ void create_min_max_statistical_fields_for_table(TABLE *table)
my_ptrdiff_t diff= record-table->record[0];
if (!bitmap_is_set(table->read_set, table_field->field_index))
continue;
if (!(fld= table_field->clone(&table->mem_root, table, diff, TRUE)))
if (!(fld= table_field->clone(&table->mem_root, table, diff)))
continue;
if (i == 0)
table_field->collected_stats->min_value= fld;
@ -2047,7 +2049,7 @@ void create_min_max_statistical_fields_for_table_share(THD *thd,
Field *fld;
Field *table_field= *field_ptr;
my_ptrdiff_t diff= record - table_share->default_values;
if (!(fld= table_field->clone(&stats_cb->mem_root, NULL, diff, TRUE)))
if (!(fld= table_field->clone(&stats_cb->mem_root, NULL, diff)))
continue;
if (i == 0)
table_field->read_stats->min_value= fld;
@ -2995,9 +2997,13 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
KEY *key_info, *key_info_end;
TABLE_SHARE *table_share= table->s;
Table_statistics *read_stats= table_share->stats_cb.table_stats;
enum_check_fields old_check_level= thd->count_cuted_fields;
DBUG_ENTER("read_statistics_for_table");
/* Don't write warnings for internal field conversions */
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
/* Read statistics from the statistical table table_stats */
stat_table= stat_tables[TABLE_STAT].table;
Table_stat table_stat(stat_table, table);
@ -3078,6 +3084,7 @@ int read_statistics_for_table(THD *thd, TABLE *table, TABLE_LIST *stat_tables)
}
table->stats_is_read= TRUE;
thd->count_cuted_fields= old_check_level;
DBUG_RETURN(0);
}