Skip to content

Commit

Permalink
Ignore reporting in thd_progress_report() if we cannot lock LOCK_thd_…
Browse files Browse the repository at this point in the history
…data

The reason for this is that Galera can lock LOCK_thd_data for a long time.

Instead of stalling any long running process, like alter or repair table,
because of progress reporting, ignore the progress reporting for this
call. Progress reporting will continue on the next call after the lock has
been released.
  • Loading branch information
montywi committed Feb 15, 2021
1 parent 8eaf4bc commit fc5e03f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4641,7 +4641,13 @@ extern "C" void thd_progress_report(MYSQL_THD thd,
return;
if (thd->progress.max_counter != max_progress) // Simple optimization
{
mysql_mutex_lock(&thd->LOCK_thd_data);
/*
Better to not wait in the unlikely event that LOCK_thd_data is locked
as Galera can potentially have this locked for a long time.
Progress counters will fix themselves after the next call.
*/
if (mysql_mutex_trylock(&thd->LOCK_thd_data))
return;
thd->progress.counter= progress;
thd->progress.max_counter= max_progress;
mysql_mutex_unlock(&thd->LOCK_thd_data);
Expand Down

0 comments on commit fc5e03f

Please sign in to comment.