Skip to content

Commit 914d114

Browse files
JelteFCommitfest Bot
authored and
Commitfest Bot
committed
Reflect the value of max_safe_fds in max_files_per_process
It is currently hard to figure out if max_safe_fds is significantly lower than max_files_per_process. This starts reflecting the value of max_safe_fds in max_files_per_process after our limit detection. We still want to have two separate variables because for the bootstrap or standalone-backend cases their values differ on purpose.
1 parent f303596 commit 914d114

File tree

1 file changed

+11
-0
lines changed
  • src/backend/storage/file

1 file changed

+11
-0
lines changed

src/backend/storage/file/fd.c

+11
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ set_max_safe_fds(void)
11991199
{
12001200
int usable_fds;
12011201
int already_open;
1202+
char *max_safe_fds_string;
12021203

12031204
/*----------
12041205
* We want to set max_safe_fds to
@@ -1214,6 +1215,16 @@ set_max_safe_fds(void)
12141215

12151216
max_safe_fds = Min(usable_fds, max_files_per_process);
12161217

1218+
/*
1219+
* Update GUC variable to allow users to see if the result is different
1220+
* than what the used value turns out to be different than what they had
1221+
* configured.
1222+
*/
1223+
max_safe_fds_string = psprintf("%d", max_safe_fds);
1224+
SetConfigOption("max_files_per_process", max_safe_fds_string,
1225+
PGC_POSTMASTER, PGC_S_OVERRIDE);
1226+
pfree(max_safe_fds_string);
1227+
12171228
/*
12181229
* Take off the FDs reserved for system() etc.
12191230
*/

0 commit comments

Comments
 (0)