1
0
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:
Sergei Golubchik
2019-05-04 13:11:25 +02:00
parent 3d7e06d4ab
commit 15c79c41e4
8 changed files with 36 additions and 35 deletions

View File

@@ -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));