mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-17845 Extreme high open file limit used
SHOW STATUS LIKE 'Open_files' was showing 18446744073709551615 my_file_opened used statistic_increment/statistic_decrement, so one-off errors were normal and expected. But they confused monitoring tools, so let's move my_file_opened to use atomics.
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
#define ETIME ETIMEDOUT /* For FreeBSD */
|
||||
#endif
|
||||
|
||||
#include <my_atomic.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERNC extern "C"
|
||||
extern "C" {
|
||||
@@ -803,6 +805,26 @@ extern uint thd_lib_detected;
|
||||
#define statistic_sub(V,C,L) (V)-=(C)
|
||||
#endif /* SAFE_STATISTICS */
|
||||
|
||||
static inline void thread_safe_increment32(int32 *value)
|
||||
{
|
||||
(void) my_atomic_add32_explicit(value, 1, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
static inline void thread_safe_decrement32(int32 *value)
|
||||
{
|
||||
(void) my_atomic_add32_explicit(value, -1, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
static inline void thread_safe_increment64(int64 *value)
|
||||
{
|
||||
(void) my_atomic_add64_explicit(value, 1, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
static inline void thread_safe_decrement64(int64 *value)
|
||||
{
|
||||
(void) my_atomic_add64_explicit(value, -1, MY_MEMORY_ORDER_RELAXED);
|
||||
}
|
||||
|
||||
/*
|
||||
No locking needed, the counter is owned by the thread
|
||||
*/
|
||||
|
Reference in New Issue
Block a user