提交 660e89c1 编写于 作者: H Heikki Linnakangas

Merge commit '5f6d7353' from PostgreSQL 8.3

This adds the log_temp_files GUC. All the other changes in this batch
we had backported already.

Conflicts:
	contrib/adminpack/adminpack.c
	contrib/pgbench/pgbench.c
	doc/README.mb.big5
	doc/TODO
	doc/src/FAQ/TODO.html
	doc/src/sgml/Makefile
	doc/src/sgml/charset.sgml
	doc/src/sgml/config.sgml
	doc/src/sgml/docguide.sgml
	src/backend/access/common/heaptuple.c
	src/backend/access/heap/heapam.c
	src/backend/storage/file/fd.c
	src/backend/utils/misc/postgresql.conf.sample
	src/include/access/heapam.h
	src/include/access/htup.h
	src/include/utils/guc.h
	src/tools/copyright
	src/tools/msvc/build.bat
	src/tools/msvc/gendef.pl
......@@ -51,7 +51,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.113 2007/01/05 22:19:21 momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.114 2007/01/09 22:00:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -1105,8 +1105,8 @@ heap_deformtuple(HeapTuple tuple,
Datum *values,
char *nulls)
{
int i;
bool *isnull = (bool *) palloc(tupleDesc->natts * sizeof(bool));
int i;
bool *isnull = (bool *) palloc(tupleDesc->natts * sizeof(bool));
heap_deform_tuple(tuple, tupleDesc, values, isnull);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.223 2007/01/05 22:19:22 momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.224 2007/01/09 22:00:59 momjian Exp $
*
*
* INTERFACE ROUTINES
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.168 2007/01/05 22:19:29 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.169 2007/01/09 22:00:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.132 2007/01/05 22:19:37 momjian Exp $
* $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.134 2007/01/09 22:03:51 momjian Exp $
*
* NOTES:
*
......@@ -52,6 +52,7 @@
#include "cdb/cdbfilerep.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "utils/guc.h"
#include "utils/workfile_mgr.h"
/* Debug_filerep_print guc temporaly added for troubleshooting */
......@@ -1030,7 +1031,8 @@ OpenNamedFile(const char *fileName,
void
FileClose(File file)
{
Vfd *vfdP;
Vfd *vfdP;
struct stat filestats;
Assert(FileIsValid(file));
......@@ -1060,6 +1062,18 @@ FileClose(File file)
{
/* reset flag so that die() interrupt won't cause problems */
vfdP->fdstate &= ~FD_TEMPORARY;
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(DEBUG1, "failed to unlink \"%s\": %m",
vfdP->fileName);
......
......@@ -11,7 +11,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.365 2007/01/05 22:19:46 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.367 2007/01/09 22:16:46 momjian Exp $
*
*--------------------------------------------------------------------
*/
......@@ -204,6 +204,7 @@ int log_min_error_statement = ERROR;
int log_min_messages = WARNING;
int client_min_messages = NOTICE;
int log_min_duration_statement = -1;
int log_temp_files = -1;
int num_temp_buffers = 1000;
......@@ -1725,6 +1726,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 number of kilobytes."),
gettext_noop("Zero logs all files. The default is -1 (turning this feature off)."),
GUC_UNIT_KB
},
&log_temp_files,
-1, -1, INT_MAX, NULL, NULL
},
{
{"pgstat_track_activity_query_size", PGC_POSTMASTER, UNGROUPED,
......
......@@ -269,6 +269,9 @@ optimizer_analyze_root_partition = on # stats collection on root partitions
#log_hostname = off
#log_statement = 'none' # none, mod, ddl, all
#log_temp_files = -1 # Log temporary files equal or larger
# than the specified number of kilobytes.
# -1 disables; 0 logs all temp files
#log_timezone = unknown # actually, defaults to TZ environment
# setting
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.118 2007/01/05 22:19:51 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.119 2007/01/09 22:01:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.88 2007/01/05 22:19:51 momjian Exp $
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.89 2007/01/09 22:01:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......
......@@ -8,7 +8,7 @@
* Copyright (c) 2000-2008, PostgreSQL Global Development Group
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.76.2.1 2009/12/09 21:58:30 tgl Exp $
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.78 2007/01/09 21:31:17 momjian Exp $
*--------------------------------------------------------------------
*/
#ifndef GUC_H
......@@ -275,6 +275,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;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.182 2007/01/05 22:20:02 momjian Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.183 2007/01/09 22:01:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册