Commit fccd8104 authored by Eugene Kosov's avatar Eugene Kosov

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ä
parent 24ec8eaf
...@@ -45,6 +45,8 @@ Created 10/21/1995 Heikki Tuuri ...@@ -45,6 +45,8 @@ Created 10/21/1995 Heikki Tuuri
#include <time.h> #include <time.h>
#endif /* !_WIN32 */ #endif /* !_WIN32 */
#include "my_counter.h"
/** File node of a tablespace or the log data space */ /** File node of a tablespace or the log data space */
struct fil_node_t; struct fil_node_t;
struct fil_space_t; struct fil_space_t;
...@@ -460,7 +462,7 @@ or write, causing a bottleneck for parallelism. */ ...@@ -460,7 +462,7 @@ or write, causing a bottleneck for parallelism. */
static const ulint OS_AIO_SYNC = 24; 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_file_writes;
extern ulint os_n_fsyncs; extern ulint os_n_fsyncs;
......
...@@ -674,7 +674,7 @@ static ulint os_aio_n_segments = ULINT_UNDEFINED; ...@@ -674,7 +674,7 @@ static ulint os_aio_n_segments = ULINT_UNDEFINED;
wait until a batch of new read requests have been posted */ wait until a batch of new read requests have been posted */
static bool os_aio_recommend_sleep_for_read_threads; 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; static ulint os_bytes_read_since_printout;
ulint os_n_file_writes; ulint os_n_file_writes;
ulint os_n_fsyncs; ulint os_n_fsyncs;
...@@ -7411,7 +7411,7 @@ os_aio_print(FILE* file) ...@@ -7411,7 +7411,7 @@ os_aio_print(FILE* file)
ULINTPF " OS fsyncs\n", ULINTPF " OS fsyncs\n",
fil_n_pending_log_flushes, fil_n_pending_log_flushes,
fil_n_pending_tablespace_flushes, fil_n_pending_tablespace_flushes,
os_n_file_reads, ulint{os_n_file_reads},
os_n_file_writes, os_n_file_writes,
os_n_fsyncs); os_n_fsyncs);
......
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