Commit fb875055 authored by Krunal Bauskar's avatar Krunal Bauskar Committed by Marko Mäkelä

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.
parent cce99405
...@@ -108,17 +108,18 @@ static void dict_stats_recalc_pool_add(table_id_t id) ...@@ -108,17 +108,18 @@ static void dict_stats_recalc_pool_add(table_id_t id)
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
ut_ad(id); ut_ad(id);
bool schedule = false;
mysql_mutex_lock(&recalc_pool_mutex); mysql_mutex_lock(&recalc_pool_mutex);
const auto begin= recalc_pool.begin(), end= recalc_pool.end(); const auto begin= recalc_pool.begin(), end= recalc_pool.end();
if (end == std::find_if(begin, end, [&](const recalc &r){return r.id == id;})) if (end == std::find_if(begin, end, [&](const recalc &r){return r.id == id;}))
{ {
recalc_pool.emplace_back(recalc{id, recalc::IDLE}); recalc_pool.emplace_back(recalc{id, recalc::IDLE});
schedule = true;
} }
mysql_mutex_unlock(&recalc_pool_mutex); mysql_mutex_unlock(&recalc_pool_mutex);
if (schedule)
if (begin == end)
dict_stats_schedule_now(); dict_stats_schedule_now();
} }
......
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