From 15c79c41e435758392a1474fccf45978fec1e45c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 4 May 2019 13:11:25 +0200 Subject: 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. --- mysys/my_open.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'mysys/my_open.c') diff --git a/mysys/my_open.c b/mysys/my_open.c index 92e46610100..aa3b0448cdb 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -105,7 +105,7 @@ int my_close(File fd, myf MyFlags) { my_free(name); } - statistic_decrement(my_file_opened, &THR_LOCK_open); + thread_safe_decrement32(&my_file_opened); DBUG_RETURN(err); } /* my_close */ @@ -133,13 +133,10 @@ File my_register_filename(File fd, const char *FileName, enum file_type DBUG_ENTER("my_register_filename"); if ((int) fd >= MY_FILE_MIN) { + thread_safe_increment32(&my_file_opened); if ((uint) fd >= my_file_limit) - { - statistic_increment(my_file_opened,&THR_LOCK_open); - DBUG_RETURN(fd); /* safeguard */ - } + DBUG_RETURN(fd); my_file_info[fd].name = (char*) my_strdup(FileName, MyFlags); - statistic_increment(my_file_opened,&THR_LOCK_open); statistic_increment(my_file_total_opened,&THR_LOCK_open); my_file_info[fd].type = type_of_file; DBUG_PRINT("exit",("fd: %d",fd)); -- cgit v1.2.1