Redefine max_files_per_process to control additionally opened files
Andres Freund <andres@anarazel.de>
Redefine max_files_per_process to control additionally opened files Until now max_files_per_process=N limited each backend to open N files in total (minus a safety factor), even if there were already more files opened in postmaster and inherited by backends. Change max_files_per_process to control how many additional files each process is allowed to open. The main motivation for this is the patch to add io_method=io_uring, which needs to open one file for each backend. Without this patch, even if RLIMIT_NOFILE is high enough, postmaster will fail in set_max_safe_fds() if started with a high max_connections. The cause of the failure is that, until now, set_max_safe_fds() subtracted the already open files from max_files_per_process. Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/w6uiicyou7hzq47mbyejubtcyb2rngkkf45fk4q7inue5kfbeo@bbfad3qyubvs Discussion: https://postgr.es/m/CAGECzQQh6VSy3KG4pN1d=h9J=D1rStFCMR+t7yh_Kwj-g87aLQ@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/config.sgml | modified | +6 −2 |
| src/backend/storage/file/fd.c | modified | +8 −6 |
| src/backend/utils/misc/guc_tables.c | modified | +1 −1 |
Documentation touched
Discussion
- Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup 31 messages · 2025-02-11 → 2026-07-07
- AIO v2.0 213 messages · 2024-09-01 → 2025-07-29