Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
be8a4318
Commit
be8a4318
authored
Jan 09, 2007
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GUC log_temp_files to log the use of temporary files.
Bill Moran
parent
1e0bf904
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
5 deletions
+52
-5
doc/src/sgml/config.sgml
doc/src/sgml/config.sgml
+18
-1
src/backend/storage/file/fd.c
src/backend/storage/file/fd.c
+17
-2
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc.c
+12
-1
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/misc/postgresql.conf.sample
+3
-0
src/include/utils/guc.h
src/include/utils/guc.h
+2
-1
No files found.
doc/src/sgml/config.sgml
View file @
be8a4318
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.
99 2006/12/12 21:30:33
momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.
100 2007/01/09 21:31:14
momjian Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
...
...
@@ -2920,6 +2920,23 @@ SELECT * FROM parent WHERE key = 2400;
</listitem>
</varlistentry>
<varlistentry id="guc-log-temp-files" xreflabel="log_temp_files">
<term><varname>log_temp_files</varname> (<type>integer</type>)</term>
<indexterm>
<primary><varname>log_temp_files</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
Controls whether temporary files are logged when deleted.
A value of zero logs all temporary files, and positive
values log only files whose size is equal or greater than
the specified number of bytes. Temporary files can be
created for sorts, hashes, and temporary results. The
default is <literal>-1</> (off).
</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>
...
...
src/backend/storage/file/fd.c
View file @
be8a4318
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.13
2 2007/01/05 22:19:37
momjian Exp $
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.13
3 2007/01/09 21:31:14
momjian Exp $
*
* NOTES:
*
...
...
@@ -50,6 +50,7 @@
#include "access/xact.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "utils/guc.h"
/*
...
...
@@ -938,7 +939,8 @@ OpenTemporaryFile(bool interXact)
void
FileClose
(
File
file
)
{
Vfd
*
vfdP
;
Vfd
*
vfdP
;
struct
stat
filestats
;
Assert
(
FileIsValid
(
file
));
...
...
@@ -968,6 +970,19 @@ FileClose(File file)
{
/* reset flag so that die() interrupt won't cause problems */
vfdP
->
fdstate
&=
~
FD_TEMPORARY
;
PG_TRACE1
(
temp__file__cleanup
,
vfdP
->
fileName
);
if
(
log_temp_files
>=
0
)
{
if
(
stat
(
vfdP
->
fileName
,
&
filestats
)
==
0
)
{
if
(
filestats
.
st_size
>=
log_temp_files
)
ereport
(
LOG
,
(
errmsg
(
"temp file: path
\"
%s
\"
size %lu"
,
vfdP
->
fileName
,
(
unsigned
long
)
filestats
.
st_size
)));
}
else
elog
(
LOG
,
"Could not stat
\"
%s
\"
: %m"
,
vfdP
->
fileName
);
}
if
(
unlink
(
vfdP
->
fileName
))
elog
(
LOG
,
"failed to unlink
\"
%s
\"
: %m"
,
vfdP
->
fileName
);
...
...
src/backend/utils/misc/guc.c
View file @
be8a4318
...
...
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.36
5 2007/01/05 22:19:46
momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.36
6 2007/01/09 21:31:14
momjian Exp $
*
*--------------------------------------------------------------------
*/
...
...
@@ -182,6 +182,7 @@ int log_min_error_statement = ERROR;
int
log_min_messages
=
NOTICE
;
int
client_min_messages
=
NOTICE
;
int
log_min_duration_statement
=
-
1
;
int
log_temp_files
=
-
1
;
int
num_temp_buffers
=
1000
;
...
...
@@ -1660,6 +1661,16 @@ static struct config_int ConfigureNamesInt[] =
&
server_version_num
,
PG_VERSION_NUM
,
PG_VERSION_NUM
,
PG_VERSION_NUM
,
NULL
,
NULL
},
{
{
"log_temp_files"
,
PGC_USERSET
,
LOGGING_WHAT
,
gettext_noop
(
"Log the use of temporary files larger than this size."
),
gettext_noop
(
"Zero logs all files. The default is -1 (turning this feature off)."
),
NULL
},
&
log_temp_files
,
-
1
,
-
1
,
INT_MAX
,
NULL
,
NULL
},
/* End-of-list marker */
{
...
...
src/backend/utils/misc/postgresql.conf.sample
View file @
be8a4318
...
...
@@ -333,6 +333,9 @@
#log_statement = 'none' # none, ddl, mod, all
#log_hostname = off
#log_temp_files = -1 # Log temporary files equal or larger
# than the specified number of bytes.
# -1 disables; 0 logs all temp files
#---------------------------------------------------------------------------
# RUNTIME STATISTICS
...
...
src/include/utils/guc.h
View file @
be8a4318
...
...
@@ -7,7 +7,7 @@
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.7
7 2007/01/05 22:19:59
momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.7
8 2007/01/09 21:31:17
momjian Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
...
...
@@ -123,6 +123,7 @@ extern int log_min_error_statement;
extern
int
log_min_messages
;
extern
int
client_min_messages
;
extern
int
log_min_duration_statement
;
extern
int
log_temp_files
;
extern
int
num_temp_buffers
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment