summaryrefslogtreecommitdiff
path: root/mysys/my_open.c
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-05-04 13:11:25 +0200
committerSergei Golubchik <serg@mariadb.org>2019-05-07 18:40:36 +0200
commit15c79c41e435758392a1474fccf45978fec1e45c (patch)
tree434cf1c13283cb5abd236b8b8068127cec06b6ba /mysys/my_open.c
parent3d7e06d4ab1c108d61ac7dd4d09287580d77add5 (diff)
downloadmariadb-git-15c79c41e435758392a1474fccf45978fec1e45c.tar.gz
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.
Diffstat (limited to 'mysys/my_open.c')
-rw-r--r--mysys/my_open.c9
1 files changed, 3 insertions, 6 deletions
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));