Commit fc5e03f0 authored by Monty's avatar Monty

Ignore reporting in thd_progress_report() if we cannot lock LOCK_thd_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.
parent 8eaf4bc5
...@@ -4641,7 +4641,13 @@ extern "C" void thd_progress_report(MYSQL_THD thd, ...@@ -4641,7 +4641,13 @@ extern "C" void thd_progress_report(MYSQL_THD thd,
return; return;
if (thd->progress.max_counter != max_progress) // Simple optimization 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.counter= progress;
thd->progress.max_counter= max_progress; thd->progress.max_counter= max_progress;
mysql_mutex_unlock(&thd->LOCK_thd_data); mysql_mutex_unlock(&thd->LOCK_thd_data);
......
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