|
13 | 13 | *
|
14 | 14 | *
|
15 | 15 | * 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 $ |
17 | 17 | *
|
18 | 18 | *-------------------------------------------------------------------------
|
19 | 19 | */
|
|
24 | 24 | #include <sys/stat.h>
|
25 | 25 |
|
26 | 26 | #include "miscadmin.h"
|
| 27 | +#ifdef PROFILE_PID_DIR |
| 28 | +#include "postmaster/autovacuum.h" |
| 29 | +#endif |
27 | 30 | #include "storage/ipc.h"
|
28 | 31 |
|
29 | 32 |
|
@@ -126,14 +129,22 @@ proc_exit(int code)
|
126 | 129 | * $PGDATA/gprof/8845/gmon.out
|
127 | 130 | * ...
|
128 | 131 | *
|
| 132 | + * To avoid undesirable disk space bloat, autovacuum workers are |
| 133 | + * discriminated against: all their gmon.out files go into the same |
<
9931
tr class="diff-line-row">
| 134 | + * subdirectory. Without this, an installation that is "just sitting |
| 135 | + * there" nonetheless eats megabytes of disk space every few seconds. |
| 136 | + * |
129 | 137 | * Note that we do this here instead of in an on_proc_exit()
|
130 | 138 | * callback because we want to ensure that this code executes
|
131 | 139 | * last - we don't want to interfere with any other on_proc_exit()
|
132 | 140 | * callback.
|
133 | 141 | */
|
134 | 142 | char gprofDirName[32];
|
135 | 143 |
|
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()); |
137 | 148 |
|
138 | 149 | mkdir("gprof", 0777);
|
139 | 150 | mkdir(gprofDirName, 0777);
|
|
0 commit comments