diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2019-12-16 18:22:59 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2020-01-12 20:30:26 +0100 |
commit | c27577a1ad2b9b46532695802545228dbfd16190 (patch) | |
tree | ce2d9c5bd7487044dc3e6bcda32787976cf0f6bf /storage/innobase/trx/trx0purge.cc | |
parent | 1bbb67b3f24bd6af9117818aed683f3c4c1374a7 (diff) | |
download | mariadb-git-c27577a1ad2b9b46532695802545228dbfd16190.tar.gz |
MDEV-21326 : Address TSAN warnings in tpool.
1. Fix places where data race warnings were relevant.
tls_worker_data::m_state should be modified under mutex protection,
since both maintainence timer and current worker set this flag.
2. Suppress warnings that are legitimate, yet harmless.
Apparently, the dirty reads in waitable_task::get_ref_count() or
write_slots->pending_io_count()
Avoiding race entirely without side-effects here is tricky,
and the effects of race is harmless.
The worst thing that can happen due to race is an extra wait notification,
under rare circumstances.
Diffstat (limited to 'storage/innobase/trx/trx0purge.cc')
-rw-r--r-- | storage/innobase/trx/trx0purge.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index c81e2ac49bb..4e0c3c9eed4 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1243,13 +1243,16 @@ extern tpool::waitable_task purge_worker_task; /** Wait for pending purge jobs to complete. */ static void trx_purge_wait_for_workers_to_complete() { - if (purge_worker_task.get_ref_count()) - { - tpool::tpool_wait_begin(); - purge_worker_task.wait(); + bool notify_wait = purge_worker_task.is_running(); + + if (notify_wait) + tpool::tpool_wait_begin(); + + purge_worker_task.wait(); + + if(notify_wait) tpool::tpool_wait_end(); - } - + /* There should be no outstanding tasks as long as the worker threads are active. */ ut_ad(srv_get_task_queue_length() == 0); |