Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5762a4d

Browse files
committed
Inherit max_safe_fds to child processes in EXEC_BACKEND mode.
Postmaster sets max_safe_fds by testing how many open file descriptors itcan open, and that is normally inherited by all child processes at fork().Not so on EXEC_BACKEND, ie. Windows, however. Because of that, weeffectively ignored max_files_per_process on Windows, and always assumeda conservative default of 32 simultaneous open files. That could have animpact on performance, if you need to access a lot of different filesin a query. After this patch, the value is passed to child processes bysave/restore_backend_variables() among many other global variables.It has been like this forever, but given the lack of complaints about it,I'm not backpatching this.
1 parentd2c1740 commit5762a4d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ typedef struct
438438
TimestampTzPgReloadTime;
439439
boolredirection_done;
440440
boolIsBinaryUpgrade;
441+
intmax_safe_fds;
441442
#ifdefWIN32
442443
HANDLEPostmasterHandle;
443444
HANDLEinitial_signal_pipe;
@@ -4741,6 +4742,7 @@ save_backend_variables(BackendParameters *param, Port *port,
47414742

47424743
param->redirection_done=redirection_done;
47434744
param->IsBinaryUpgrade=IsBinaryUpgrade;
4745+
param->max_safe_fds=max_safe_fds;
47444746

47454747
#ifdefWIN32
47464748
param->PostmasterHandle=PostmasterHandle;
@@ -4964,6 +4966,7 @@ restore_backend_variables(BackendParameters *param, Port *port)
49644966

49654967
redirection_done=param->redirection_done;
49664968
IsBinaryUpgrade=param->IsBinaryUpgrade;
4969+
max_safe_fds=param->max_safe_fds;
49674970

49684971
#ifdefWIN32
49694972
PostmasterHandle=param->PostmasterHandle;

‎src/backend/storage/file/fd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ intmax_files_per_process = 1000;
103103
* Note: the value of max_files_per_process is taken into account while
104104
* setting this variable, and so need not be tested separately.
105105
*/
106-
staticintmax_safe_fds=32;/* default if not changed */
106+
intmax_safe_fds=32;/* default if not changed */
107107

108108

109109
/* Debugging.... */

‎src/include/storage/fd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ typedef int File;
5353
/* GUC parameter */
5454
externintmax_files_per_process;
5555

56+
/*
57+
* This is private to fd.c, but exported for save/restore_backend_variables()
58+
*/
59+
externintmax_safe_fds;
60+
5661

5762
/*
5863
* prototypes for functions in fd.c

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp