diff options
author | Monty <monty@mariadb.org> | 2021-02-15 20:21:12 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2021-02-15 20:21:29 +0200 |
commit | fc5e03f093b80aab41e00cba9b6dd1554a15df6d (patch) | |
tree | b11e93a5e8a8a50f1bdeb7d6d2c8bed0c7de09d0 /sql/sql_class.cc | |
parent | 8eaf4bc5ec05a8dfc44c044bd52db3a3719f502a (diff) | |
download | mariadb-git-fc5e03f093b80aab41e00cba9b6dd1554a15df6d.tar.gz |
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.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 69e60109d42..500bf50bf9d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -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); |