diff options
author | Krunal Bauskar <mysqlonarm@gmail.com> | 2022-02-11 18:10:50 +0800 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-02-11 12:32:11 +0200 |
commit | fb875055c617832c19c1f7f5c44960eaf424a0c9 (patch) | |
tree | 5f4fd4d1c529f12fb7b53f9670662e8e0caaeefb | |
parent | cce994057bf7e2bdb62686075de03aeb5db4bbda (diff) | |
download | mariadb-git-fb875055c617832c19c1f7f5c44960eaf424a0c9.tar.gz |
MDEV-27805: tpcc workload shows regression with MDB-10.6
- regression got revealed while running tpcc workload.
- as part of MDEV-25919 changes logic for statistics computation was revamped.
- if the table has changed to certain threshold then table is added to
statistics recomputation queue (dict_stats_recalc_pool_add)
- after the table is added to queue the background statistics thread is
notified
- during revamp the condition to notify background statistics threads was
wrongly updated to check if the queue/vector is empty when it should
check if there is queue/vector has entries to process.
- vec.begin() == vec.end() : only when vector is empty
- also accessing these iterator outside the parallely changing vector is not
safe
- fix now tend to notify background statistics thread if the logic adds
an entry to the queue/vector.
-rw-r--r-- | storage/innobase/dict/dict0stats_bg.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index 645f5818f57..2dd83d97687 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -108,17 +108,18 @@ static void dict_stats_recalc_pool_add(table_id_t id) { ut_ad(!srv_read_only_mode); ut_ad(id); + bool schedule = false; mysql_mutex_lock(&recalc_pool_mutex); const auto begin= recalc_pool.begin(), end= recalc_pool.end(); if (end == std::find_if(begin, end, [&](const recalc &r){return r.id == id;})) { recalc_pool.emplace_back(recalc{id, recalc::IDLE}); + schedule = true; } mysql_mutex_unlock(&recalc_pool_mutex); - - if (begin == end) + if (schedule) dict_stats_schedule_now(); } |