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

Commit69500b0

Browse files
committed
Prevent continuing disk-space bloat when profiling (with PROFILE_PID_DIR
enabled) and autovacuum is on. Since there will be a steady stream of autovacworker processes exiting and dropping gmon.out files, allowing them to makeseparate subdirectories results in serious bloat; and it seems unlikely thatanyone will care about those profiles anyway. Limit the damage by forcing allautovac workers to dump in one subdirectory, PGDATA/gprof/avworker/.Per report from J�rg Beyer and subsequent discussion.
1 parenta2899eb commit69500b0

File tree

1 file changed

+13
-2
lines changed
  • src/backend/storage/ipc

1 file changed

+13
-2
lines changed

‎src/backend/storage/ipc/ipc.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.97 2007/07/25 19:58:56 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.98 2007/11/04 17:55:15 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -24,6 +24,9 @@
2424
#include<sys/stat.h>
2525

2626
#include"miscadmin.h"
27+
#ifdefPROFILE_PID_DIR
28+
#include"postmaster/autovacuum.h"
29+
#endif
2730
#include"storage/ipc.h"
2831

2932

@@ -126,14 +129,22 @@ proc_exit(int code)
126129
*$PGDATA/gprof/8845/gmon.out
127130
*...
128131
*
132+
* To avoid undesirable disk space bloat, autovacuum workers are
133+
* discriminated against: all their gmon.out files go into the same
134+
* subdirectory. Without this, an installation that is "just sitting
135+
* there" nonetheless eats megabytes of disk space every few seconds.
136+
*
129137
* Note that we do this here instead of in an on_proc_exit()
130138
* callback because we want to ensure that this code executes
131139
* last - we don't want to interfere with any other on_proc_exit()
132140
* callback.
133141
*/
134142
chargprofDirName[32];
135143

136-
snprintf(gprofDirName,32,"gprof/%d", (int)getpid());
144+
if (IsAutoVacuumWorkerProcess())
145+
snprintf(gprofDirName,32,"gprof/avworker");
146+
else
147+
snprintf(gprofDirName,32,"gprof/%d", (int)getpid());
137148

138149
mkdir("gprof",0777);
139150
mkdir(gprofDirName,0777);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp