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

Commit79dc97a

Browse files
committed
Bring some sanity to the trace_recovery_messages code and docs.
Per gripe from Fujii Masao, though this is not exactly his proposed patch.Categorize as DEVELOPER_OPTIONS and set context PGC_SIGHUP, as per Fujii,but set the default to LOG because higher values aren't really sensible(see the code for trace_recovery()). Fix the documentation to agree withthe code and to try to explain what the variable actually does. Get ridof no-op calls trace_recovery(LOG), which accomplish nothing except todemonstrate that this option confuses even its author.
1 parent9676b01 commit79dc97a

File tree

4 files changed

+48
-38
lines changed

4 files changed

+48
-38
lines changed

‎doc/src/sgml/config.sgml

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.304 2010/08/17 04:37:20 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.305 2010/08/19 22:55:00 tgl Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -5777,6 +5777,31 @@ plruby.use_strict = true # generates error: unknown class name
57775777
</listitem>
57785778
</varlistentry>
57795779

5780+
<varlistentry id="guc-trace-recovery-messages" xreflabel="trace_recovery_messages">
5781+
<term><varname>trace_recovery_messages</varname> (<type>enum</type>)</term>
5782+
<indexterm>
5783+
<primary><varname>trace_recovery_messages</> configuration parameter</primary>
5784+
</indexterm>
5785+
<listitem>
5786+
<para>
5787+
Enables logging of recovery-related debugging output that otherwise
5788+
would not be logged. This parameter allows the user to override the
5789+
normal setting of <xref linkend="guc-log-min-messages">, but only for
5790+
specific messages. This is intended for use in debugging Hot Standby.
5791+
Valid values are <literal>DEBUG5</>, <literal>DEBUG4</>,
5792+
<literal>DEBUG3</>, <literal>DEBUG2</>, <literal>DEBUG1</>, and
5793+
<literal>LOG</>. The default, <literal>LOG</>, does not affect
5794+
logging decisions at all. The other values cause recovery-related
5795+
debug messages of that priority or higher to be logged as though they
5796+
had <literal>LOG</> priority; for common settings of
5797+
<varname>log_min_messages</> this results in unconditionally sending
5798+
them to the server log.
5799+
This parameter can only be set in the <filename>postgresql.conf</>
5800+
file or on the server command line.
5801+
</para>
5802+
</listitem>
5803+
</varlistentry>
5804+
57805805
<varlistentry id="guc-trace-sort" xreflabel="trace_sort">
57815806
<term><varname>trace_sort</varname> (<type>boolean</type>)</term>
57825807
<indexterm>
@@ -5959,32 +5984,6 @@ LOG: CleanUpLock: deleting: lock(0xb7acd844) id(24688,24696,0,0,0,1)
59595984
</listitem>
59605985
</varlistentry>
59615986

5962-
<varlistentry id="guc-trace-recovery-messages" xreflabel="trace_recovery_messages">
5963-
<term><varname>trace_recovery_messages</varname> (<type>enum</type>)</term>
5964-
<indexterm>
5965-
<primary><varname>trace_recovery_messages</> configuration parameter</primary>
5966-
</indexterm>
5967-
<listitem>
5968-
<para>
5969-
Controls which message levels are written to the server log
5970-
for system modules needed for recovery processing. This allows
5971-
the user to override the normal setting of log_min_messages,
5972-
but only for specific messages. This is intended for use in
5973-
debugging Hot Standby.
5974-
Valid values are <literal>DEBUG5</>, <literal>DEBUG4</>,
5975-
<literal>DEBUG3</>, <literal>DEBUG2</>, <literal>DEBUG1</>,
5976-
<literal>INFO</>, <literal>NOTICE</>, <literal>WARNING</>,
5977-
<literal>ERROR</>, <literal>LOG</>, <literal>FATAL</>, and
5978-
<literal>PANIC</>. Each level includes all the levels that
5979-
follow it. The later the level, the fewer messages are sent
5980-
to the log. The default is <literal>WARNING</>. Note that
5981-
<literal>LOG</> has a different rank here than in
5982-
<varname>client_min_messages</>.
5983-
Parameter should be set in <filename>postgresql.conf</filename> only.
5984-
</para>
5985-
</listitem>
5986-
</varlistentry>
5987-
59885987
<varlistentry id="guc-zero-damaged-pages" xreflabel="zero_damaged_pages">
59895988
<term><varname>zero_damaged_pages</varname> (<type>boolean</type>)</term>
59905989
<indexterm>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/storage/ipc/standby.c,v 1.28 2010/08/12 23:24:54 rhaas Exp $
14+
* $PostgreSQL: pgsql/src/backend/storage/ipc/standby.c,v 1.29 2010/08/19 22:55:01 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -591,7 +591,7 @@ StandbyReleaseLocks(TransactionId xid)
591591
lock->xid,lock->dbOid,lock->relOid);
592592
SET_LOCKTAG_RELATION(locktag,lock->dbOid,lock->relOid);
593593
if (!LockRelease(&locktag,AccessExclusiveLock, true))
594-
elog(trace_recovery(LOG),
594+
elog(LOG,
595595
"RecoveryLockList contains entry for lock no longer recorded by lock manager: xid %u database %u relation %u",
596596
lock->xid,lock->dbOid,lock->relOid);
597597

@@ -655,7 +655,7 @@ StandbyReleaseLocksMany(TransactionId removeXid, bool keepPreparedXacts)
655655
lock->xid,lock->dbOid,lock->relOid);
656656
SET_LOCKTAG_RELATION(locktag,lock->dbOid,lock->relOid);
657657
if (!LockRelease(&locktag,AccessExclusiveLock, true))
658-
elog(trace_recovery(LOG),
658+
elog(LOG,
659659
"RecoveryLockList contains entry for lock no longer recorded by lock manager: xid %u database %u relation %u",
660660
lock->xid,lock->dbOid,lock->relOid);
661661
RecoveryLockList=list_delete_cell(RecoveryLockList,cell,prev);

‎src/backend/utils/error/elog.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
*
4444
* IDENTIFICATION
45-
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.225 2010/07/18 23:43:32 tgl Exp $
45+
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.226 2010/08/19 22:55:01 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -2798,12 +2798,19 @@ is_log_level_output(int elevel, int log_min_level)
27982798
}
27992799

28002800
/*
2801-
* If trace_recovery_messages is set to make this visible, then show as LOG,
2802-
* else display as whatever level is set. It may still be shown, but only
2803-
* if log_min_messages is set lower than trace_recovery_messages.
2801+
* Adjust the level of a recovery-related message per trace_recovery_messages.
2802+
*
2803+
* The argument is the default log level of the message, eg, DEBUG2. (This
2804+
* should only be applied to DEBUGn log messages, otherwise it's a no-op.)
2805+
* If the level is >= trace_recovery_messages, we return LOG, causing the
2806+
* message to be logged unconditionally (for most settings of
2807+
* log_min_messages). Otherwise, we return the argument unchanged.
2808+
* The message will then be shown based on the setting of log_min_messages.
28042809
*
28052810
* Intention is to keep this for at least the whole of the 9.0 production
28062811
* release, so we can more easily diagnose production problems in the field.
2812+
* It should go away eventually, though, because it's an ugly and
2813+
* hard-to-explain kluge.
28072814
*/
28082815
int
28092816
trace_recovery(inttrace_level)

‎src/backend/utils/misc/guc.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.567 2010/08/13 20:10:53 rhaas Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.568 2010/08/19 22:55:01 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -2829,13 +2829,17 @@ static struct config_enum ConfigureNamesEnum[] =
28292829
},
28302830

28312831
{
2832-
{"trace_recovery_messages",PGC_SUSET,LOGGING_WHEN,
2833-
gettext_noop("Sets the message levels that are logged during recovery."),
2832+
{"trace_recovery_messages",PGC_SIGHUP,DEVELOPER_OPTIONS,
2833+
gettext_noop("Enables logging of recovery-related debugging information."),
28342834
gettext_noop("Each level includes all the levels that follow it. The later"
28352835
" the level, the fewer messages are sent.")
28362836
},
28372837
&trace_recovery_messages,
2838-
DEBUG1,server_message_level_options,NULL,NULL
2838+
/*
2839+
* client_message_level_options allows too many values, really,
2840+
* but it's not worth having a separate options array for this.
2841+
*/
2842+
LOG,client_message_level_options,NULL,NULL
28392843
},
28402844

28412845
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp