diff options
author | Eugene Kosov <claprix@yandex.ru> | 2020-12-02 09:58:50 +0300 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2020-12-03 11:55:21 +0300 |
commit | fccd8104040aefa5e610159f219bf3e083af3eac (patch) | |
tree | f12c70a43f8d7ad4ba56244353ce326bfdd494c2 | |
parent | 24ec8eaf66ecd864529309c5edcb8dd6b685f2aa (diff) | |
download | mariadb-git-fccd8104040aefa5e610159f219bf3e083af3eac.tar.gz |
MDEV-24333 Data race in os_file_pread at os/os0file.cc:3308 on os_n_file_reads
os_n_file_reads: make Atomic_counter and correct the semantics of an imprecise
counter.
Reviewed by: Marko Mäkelä
-rw-r--r-- | storage/innobase/include/os0file.h | 4 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index bdd078a7740..dbc53d0b786 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -45,6 +45,8 @@ Created 10/21/1995 Heikki Tuuri #include <time.h> #endif /* !_WIN32 */ +#include "my_counter.h" + /** File node of a tablespace or the log data space */ struct fil_node_t; struct fil_space_t; @@ -460,7 +462,7 @@ or write, causing a bottleneck for parallelism. */ static const ulint OS_AIO_SYNC = 24; /* @} */ -extern ulint os_n_file_reads; +extern Atomic_counter<ulint> os_n_file_reads; extern ulint os_n_file_writes; extern ulint os_n_fsyncs; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 27b26d4f5b1..f96ff6b5171 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -674,7 +674,7 @@ static ulint os_aio_n_segments = ULINT_UNDEFINED; wait until a batch of new read requests have been posted */ static bool os_aio_recommend_sleep_for_read_threads; -ulint os_n_file_reads; +Atomic_counter<ulint> os_n_file_reads; static ulint os_bytes_read_since_printout; ulint os_n_file_writes; ulint os_n_fsyncs; @@ -7411,7 +7411,7 @@ os_aio_print(FILE* file) ULINTPF " OS fsyncs\n", fil_n_pending_log_flushes, fil_n_pending_tablespace_flushes, - os_n_file_reads, + ulint{os_n_file_reads}, os_n_file_writes, os_n_fsyncs); |