Skip to content

Commit

Permalink
MDEV-33046 race condition in InnoDB dict_stats_schedule()
Browse files Browse the repository at this point in the history
it can be invoked with ms=0. In that case dict_stats_func is
invoked immediately, it calls dict_stats_process_entry_from_recalc_pool()
which at the end might try to call dict_stats_schedule() again to
queue another recalc. And it can happen that the first
dict_stats_schedule(0) call didn't release dict_stats_mutex yet,
so the second dict_stats_schedule() won't queue a recalc. And as a
result the table won't have its stats recalculated at all, not now,
not later.

This causes innodb.innodb_stats_auto_recalc to fail sporadically.

This commit doesn't fix it but makes it less likely to occur which happens
to be enough for the test to pass. Proper fix is coming soon.
  • Loading branch information
vuvova committed Dec 17, 2023
1 parent 0930eb8 commit aff5ed3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage/innobase/dict/dict0stats_bg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static void dict_stats_schedule(int ms)

void dict_stats_schedule_now()
{
dict_stats_schedule(0);
dict_stats_schedule(10);
}

/** Shut down the dict_stats_thread. */
Expand Down

0 comments on commit aff5ed3

Please sign in to comment.