1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Fixed crash in is_stat_table() when using hash joins.

Other usage if persistent statistics is checking 'stats_is_read' in
caller, which is why this was not noticed earlier.

Other things:
- Simplified no_stat_values_provided
This commit is contained in:
Monty
2023-10-18 17:13:21 +03:00
parent 6991b1c47c
commit a1b6befc78
4 changed files with 57 additions and 9 deletions

View File

@@ -3125,7 +3125,8 @@ void TABLE_STATISTICS_CB::update_stats_in_table(TABLE *table)
for ( ; *field_ptr; field_ptr++, column_stats++)
(*field_ptr)->read_stats= column_stats;
/* Mark that stats are now usable */
table->stats_is_read= true;
table->stats_is_read= (table->stats_cb->stats_available !=
TABLE_STAT_NO_STATS);
}
@@ -3246,8 +3247,6 @@ read_statistics_for_tables(THD *thd, TABLE_LIST *tables, bool force_reload)
}
mysql_mutex_unlock(&table_share->LOCK_statistics);
table->stats_cb->update_stats_in_table(table);
table->stats_is_read= (stats_cb->stats_available !=
TABLE_STAT_NO_STATS);
}
}
@@ -4312,11 +4311,9 @@ bool is_eits_usable(Field *field)
Column_statistics* col_stats= field->read_stats;
// check if column_statistics was allocated for this field
if (!col_stats)
if (!col_stats || !field->table->stats_is_read)
return false;
DBUG_ASSERT(field->table->stats_is_read);
/*
(1): checks if we have EITS statistics for a particular column
(2): Don't use EITS for GEOMETRY columns