[MDEV-32977] InnoDB Cannot close file Pending operations and pending fsync Created: 2023-12-09  Updated: 2024-01-02

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.6.16
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Dominik Shaim Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Ubuntu 20, mariadb 10.6.16, fully NVME pcie 4.0, high end server, hundreds databases with hundreds tables



 Description   

Hi,

we have version 10.6 more than year. Yesterday we updated to 10.6.16 (before 10.6.12), we hoped it will solve our problem, but it doesn't.

ur mariadb error log is filled repeatelly with problems with pending operations, pending fsync.

Don't know what's problem. I know, its 'NOTE", not 'WARNING'/'ERROR', but...

Example of 3 types of "error":
A) pending fsync:
[Note] InnoDB: Cannot close file ./XXX/YYY.ibd because of pending fsync

B) pending operations:
[Note] InnoDB: Cannot close file ./XXX/YYY.ibd because of 4 pending operations

C) both:
[Note] InnoDB: Cannot close file ./XXX/YYY.ibd because of 8 pending operations and pending fsync

Every time its another database or table, not same. We have about 100 lines per day logged with this.

We are thinking to upgrade 10.6 to 10.11, but not sure, if this can helps, because 10.6 is still maintained for long time, so...

If it will necessary, I can provide more informations, ask me if something else is needed.
MariaDB 10.1 and 10.3 without problem.
We have high end server and fully nvme pcie 4.0 drivers.
We have hundreds of databases and every database have hundreds of tables.
We aren't facing any problems with real performance.
Ubuntu 20, kernel 5.4.0-156-generic
2x CPU Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz (Total 40 cores, 80 threads)
innodb_buffer_pool_size=200G
innodb_io_capacity=2000
innodb_io_capacity_max=4000
Total server RAM is 756G

Thank you.



 Comments   
Comment by Marko Mäkelä [ 2023-12-10 ]

The messages indicate that the innodb_open_files is being exceeded. Have you tried to specify that parameter?

What is your innodb_log_file_size? A larger value may slow down crash recovery (although MDEV-29911 improved that), but it will also reduce the pressure on page flushing. You might also want to specify a nonzero innodb_max_dirty_pages_pct_lwm and apply the fix of MDEV-31939 to make the page flushing rate more stable.

Comment by Dominik Shaim [ 2023-12-10 ]

So, it's not bug only "feature" if I understand it well?
I can try increate innodb_open_files, but how can I get the "correct" value? Any hint?
(Now it is 400)

innodb_log_file_size is 1GB.

innodb_max_dirty_pages_pct_lwm is now zero.

Comment by Marko Mäkelä [ 2023-12-11 ]

Yes, I think that this is more a feature than a bug. I am not familiar enough with the Linux kernel to say what would be an "insane" amount of open file descriptors. I have seen a rule of thumb that innodb_log_file_size should be large enough for about 1 hour of writes to the database (LSN growth over an hour, interpreted as bytes). Currently your log file is only 0.5% of the buffer pool size. Have you thought of increasing it?

Comment by Dominik Shaim [ 2023-12-11 ]

Ah :/ I think it's a bug, ok, well. It's better than solving bug. We can try to change this.

We have "low" innodb_log_file_size because of recovery... What size you suggest us? For example, if our DB crashed, we can't wait XX minutes for recover :/ We have busy servers with a hundreds of customers eshops.

But you told me to change "innodb_open_files". What is relation this directive to "innodb_log_file_size"?

In every case, we can try increase "innodb_open_files", but not sure, if try 500, 600 or 2000 or 20000 etc. Can you tell me any "best practices" about this? (already tried documentation and google, but without success).
Of course, I'm just asking for information, without a guarantee from you.

Is it enough to change innodb_open_files or is necessary make innodb_log_file_size higher as well?

Thank you.

Comment by Marko Mäkelä [ 2023-12-11 ]

We have a separate support forum for paying customers. I suspect that the log checkpoint pressure due to a small log file size is causing bursts of writes to large numbers of data files. You can just ignore the messages or try to increase the number of open files until the messages become more rare. You may also test how long the typical crash recovery time actually is with some different values of innodb_log_file_size.

Comment by Dominik Shaim [ 2023-12-11 ]

OK, I understand. Can you share informations about this forum for paying customers?

What's next, should I close this issue now? (Because I think before, it's any type of bug, but as you already wrote, it's feature)

Or leave open now and post here update after we will change values? (maybe it will helps someone else as well)

Comment by Dominik Shaim [ 2023-12-24 ]

We changed 3 days ago:
innodb_open_files 400 -> 512
innodb_log_file_size 1GB -> 2GB

But behaviour stayed nearly same, not much changes (tested 3 days, still same).
Every day approximatelly 60-80 logged records with "pending" text.
Before approximatelly 80-100, so its not good change, but maybe it's because now is less traffic (Christmas).. so :/

Any recommendation please?

Should we try again to increase both of these limits?

Btw, we updated to mariabd 10.11, still "same" (approximatelly 50 per day) - but now is low traffic because of holiday.

Comment by Marko Mäkelä [ 2024-01-02 ]

The warning message merely says that the configured innodb_open_files is being exceeded. Closing and reopening files does incur some overhead, and therefore it would make sense to set innodb_open_files as large as possible. The default value makes me think of old things like FILES=30 in the MS-DOS CONFIG.SYS. https://unix.stackexchange.com/questions/84227/limits-on-the-number-of-file-descriptors mentions the Linux /proc/sys/fs/file-max, which identifies a global limit of file descriptors. On my AMD64 system, that is 2⁶³-1, so it does not look like an accurate limit. The first field of the file /proc/sys/fs/file-nr reflects the number of currently open file descriptors, which is 12,802 on my desktop system, with some 1½ hours of uptime and after some light GUI usage.

I found a definition of the Linux kernel struct file in include/linux/fs.h. I might assume that most of its members are 64 or 128 bits. The member f_path looks a bit suspicious, but it turns out that struct path only encapsulates 2 pointers. There are about 20 data members in struct file in total. It would seem that an open file handle would consume between a couple hundred bytes and a couple kilobytes, depending on the absolute path name lengths, overlay mounts and whatnot. I’m guessing here, but a gigabyte of memory could cover one million open file handles. Based on that, you might considerably increase the innodb_open_files limit.

Again, this system is for reporting bugs in MariaDB products. Support for paying customers is provided by other means.

Comment by Dominik Shaim [ 2024-01-02 ]

OK, understand, thank you for detailed explanation.

Should I close this? Or post here update after another increate innodb_open_files?

Generated at Thu Feb 08 10:35:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.