mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Add checkpoint_warning to warn of excessive checkpoints caused by too
few WAL files.
This commit is contained in:
parent
3779f7fd9f
commit
2986aa6a66
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.154 2002/11/15 01:57:25 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.155 2002/11/15 02:44:50 momjian Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Chapter Id="runtime">
|
<Chapter Id="runtime">
|
||||||
@ -2081,6 +2081,18 @@ dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib:$libdir'
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>CHECKPOINT_WARNING</varname> (<type>integer</type>)</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Send a message to the server logs if checkpoints caused by the
|
||||||
|
filling of checkpoint segment files happens more frequently than
|
||||||
|
this number of seconds. Zero turns off the warning.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>COMMIT_DELAY</varname> (<type>integer</type>)</term>
|
<term><varname>COMMIT_DELAY</varname> (<type>integer</type>)</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/wal.sgml,v 1.21 2002/11/02 22:23:01 tgl Exp $ -->
|
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/wal.sgml,v 1.22 2002/11/15 02:44:54 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="wal">
|
<chapter id="wal">
|
||||||
<title>Write-Ahead Logging (<acronym>WAL</acronym>)</title>
|
<title>Write-Ahead Logging (<acronym>WAL</acronym>)</title>
|
||||||
@ -300,6 +300,16 @@
|
|||||||
correspondingly increase shared memory usage.
|
correspondingly increase shared memory usage.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Checkpoints are fairly expensive because they force all dirty kernel
|
||||||
|
buffers to disk using the operating system <literal>sync()</> call.
|
||||||
|
Busy servers may fill checkpoint segment files too quickly,
|
||||||
|
causing excessive checkpointing. If such forced checkpoints happen
|
||||||
|
more frequently than <varname>CHECKPOINT_WARNING</varname> seconds,
|
||||||
|
a message, will be output to the server logs recommending increasing
|
||||||
|
<varname>CHECKPOINT_SEGMENTS</varname>.
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <varname>COMMIT_DELAY</varname> parameter defines for how many
|
The <varname>COMMIT_DELAY</varname> parameter defines for how many
|
||||||
microseconds the backend will sleep after writing a commit
|
microseconds the backend will sleep after writing a commit
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.296 2002/11/15 01:57:26 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.297 2002/11/15 02:44:55 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -198,6 +198,8 @@ bool SilentMode = false; /* silent mode (-S) */
|
|||||||
int PreAuthDelay = 0;
|
int PreAuthDelay = 0;
|
||||||
int AuthenticationTimeout = 60;
|
int AuthenticationTimeout = 60;
|
||||||
int CheckPointTimeout = 300;
|
int CheckPointTimeout = 300;
|
||||||
|
int CheckPointWarning = 30;
|
||||||
|
time_t LastSignalledCheckpoint = 0;
|
||||||
|
|
||||||
bool log_hostname; /* for ps display */
|
bool log_hostname; /* for ps display */
|
||||||
bool LogSourcePort;
|
bool LogSourcePort;
|
||||||
@ -2329,6 +2331,22 @@ sigusr1_handler(SIGNAL_ARGS)
|
|||||||
|
|
||||||
if (CheckPostmasterSignal(PMSIGNAL_DO_CHECKPOINT))
|
if (CheckPostmasterSignal(PMSIGNAL_DO_CHECKPOINT))
|
||||||
{
|
{
|
||||||
|
if (CheckPointWarning != 0)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* This only times checkpoints forced by running out of
|
||||||
|
* segment files. Other checkpoints could reduce
|
||||||
|
* the frequency of forced checkpoints.
|
||||||
|
*/
|
||||||
|
time_t now = time(NULL);
|
||||||
|
|
||||||
|
if (now - LastSignalledCheckpoint < CheckPointWarning)
|
||||||
|
elog(LOG, "Checkpoint segments are being created too frequently (%d secs)\n
|
||||||
|
Consider increasing CHECKPOINT_SEGMENTS",
|
||||||
|
now - LastSignalledCheckpoint);
|
||||||
|
LastSignalledCheckpoint = now;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Request to schedule a checkpoint
|
* Request to schedule a checkpoint
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* command, configuration file, and command line options.
|
* command, configuration file, and command line options.
|
||||||
* See src/backend/utils/misc/README for more information.
|
* See src/backend/utils/misc/README for more information.
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.105 2002/11/15 01:57:27 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.106 2002/11/15 02:44:57 momjian Exp $
|
||||||
*
|
*
|
||||||
* Copyright 2000 by PostgreSQL Global Development Group
|
* Copyright 2000 by PostgreSQL Global Development Group
|
||||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||||
@ -660,6 +660,11 @@ static struct config_int
|
|||||||
300, 30, 3600, NULL, NULL
|
300, 30, 3600, NULL, NULL
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
{"checkpoint_warning", PGC_SIGHUP}, &CheckPointWarning,
|
||||||
|
30, 0, INT_MAX, NULL, NULL
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
{"wal_buffers", PGC_POSTMASTER}, &XLOGbuffers,
|
{"wal_buffers", PGC_POSTMASTER}, &XLOGbuffers,
|
||||||
8, 4, INT_MAX, NULL, NULL
|
8, 4, INT_MAX, NULL, NULL
|
||||||
|
@ -65,6 +65,7 @@
|
|||||||
#
|
#
|
||||||
#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
|
#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each
|
||||||
#checkpoint_timeout = 300 # range 30-3600, in seconds
|
#checkpoint_timeout = 300 # range 30-3600, in seconds
|
||||||
|
#checkpoint_warning = 30 # 0 is off, in seconds
|
||||||
#
|
#
|
||||||
#commit_delay = 0 # range 0-100000, in microseconds
|
#commit_delay = 0 # range 0-100000, in microseconds
|
||||||
#commit_siblings = 5 # range 1-1000
|
#commit_siblings = 5 # range 1-1000
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: xlog.h,v 1.39 2002/09/26 22:58:34 tgl Exp $
|
* $Id: xlog.h,v 1.40 2002/11/15 02:44:57 momjian Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef XLOG_H
|
#ifndef XLOG_H
|
||||||
#define XLOG_H
|
#define XLOG_H
|
||||||
@ -184,6 +184,7 @@ extern XLogRecPtr ProcLastRecEnd;
|
|||||||
|
|
||||||
/* these variables are GUC parameters related to XLOG */
|
/* these variables are GUC parameters related to XLOG */
|
||||||
extern int CheckPointSegments;
|
extern int CheckPointSegments;
|
||||||
|
extern int CheckPointWarning;
|
||||||
extern int XLOGbuffers;
|
extern int XLOGbuffers;
|
||||||
extern int XLOG_DEBUG;
|
extern int XLOG_DEBUG;
|
||||||
extern char *XLOG_sync_method;
|
extern char *XLOG_sync_method;
|
||||||
|
Loading…
Reference in New Issue
Block a user