MDEV-10682 Race condition between ANALYZE and STATS_AUTO_RECALC
ha_innobase::info_low(): While collecting statistics for ANALYZE TABLE, ensure that dict_stats_process_entry_from_recalc_pool() is not executing on the same table. We observed result differences for the test innodb.innodb_stats because dict_stats_empty_index() was being invoked by the background statistics calculation while ha_innobase::analyze() was executing dict_stats_analyze_index_level().
This commit is contained in:
parent
6505662c23
commit
c557e9540a
@ -14411,6 +14411,13 @@ ha_innobase::info_low(
|
||||
if (dict_stats_is_persistent_enabled(ib_table)) {
|
||||
|
||||
if (is_analyze) {
|
||||
row_mysql_lock_data_dictionary(
|
||||
m_prebuilt->trx);
|
||||
dict_stats_recalc_pool_del(ib_table);
|
||||
dict_stats_wait_bg_to_stop_using_table(
|
||||
ib_table, m_prebuilt->trx);
|
||||
row_mysql_unlock_data_dictionary(
|
||||
m_prebuilt->trx);
|
||||
opt = DICT_STATS_RECALC_PERSISTENT;
|
||||
} else {
|
||||
/* This is e.g. 'SHOW INDEXES', fetch
|
||||
@ -14423,6 +14430,13 @@ ha_innobase::info_low(
|
||||
|
||||
ret = dict_stats_update(ib_table, opt);
|
||||
|
||||
if (opt == DICT_STATS_RECALC_PERSISTENT) {
|
||||
mutex_enter(&dict_sys->mutex);
|
||||
ib_table->stats_bg_flag
|
||||
&= byte(~BG_STAT_SHOULD_QUIT);
|
||||
mutex_exit(&dict_sys->mutex);
|
||||
}
|
||||
|
||||
if (ret != DB_SUCCESS) {
|
||||
m_prebuilt->trx->op_info = "";
|
||||
DBUG_RETURN(HA_ERR_GENERIC);
|
||||
|
Loading…
x
Reference in New Issue
Block a user