Skip to content

Commit c7a3e6b

Browse files
committed
Remove trace_recovery_messages
This GUC was intended as a debugging help in the 9.0 area when hot standby and streaming replication were being developped, able to offer more information at LOG level rather than DEBUGn. There are more tools available these days that are able to offer rather equivalent information, like pg_waldump introduced in 9.3. It is not obvious how this facility is useful these days, so let's remove it. Author: Bharath Rupireddy Discussion: https://postgr.es/m/ZXEXEAUVFrvpquSd@paquier.xyz
1 parent 8d7d219 commit c7a3e6b

File tree

9 files changed

+19
-97
lines changed

9 files changed

+19
-97
lines changed

doc/src/sgml/config.sgml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11216,32 +11216,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1121611216
</listitem>
1121711217
</varlistentry>
1121811218

11219-
<varlistentry id="guc-trace-recovery-messages" xreflabel="trace_recovery_messages">
11220-
<term><varname>trace_recovery_messages</varname> (<type>enum</type>)
11221-
<indexterm>
11222-
<primary><varname>trace_recovery_messages</varname> configuration parameter</primary>
11223-
</indexterm>
11224-
</term>
11225-
<listitem>
11226-
<para>
11227-
Enables logging of recovery-related debugging output that otherwise
11228-
would not be logged. This parameter allows the user to override the
11229-
normal setting of <xref linkend="guc-log-min-messages"/>, but only for
11230-
specific messages. This is intended for use in debugging hot standby.
11231-
Valid values are <literal>DEBUG5</literal>, <literal>DEBUG4</literal>,
11232-
<literal>DEBUG3</literal>, <literal>DEBUG2</literal>, <literal>DEBUG1</literal>, and
11233-
<literal>LOG</literal>. The default, <literal>LOG</literal>, does not affect
11234-
logging decisions at all. The other values cause recovery-related
11235-
debug messages of that priority or higher to be logged as though they
11236-
had <literal>LOG</literal> priority; for common settings of
11237-
<varname>log_min_messages</varname> this results in unconditionally sending
11238-
them to the server log.
11239-
This parameter can only be set in the <filename>postgresql.conf</filename>
11240-
file or on the server command line.
11241-
</para>
11242-
</listitem>
11243-
</varlistentry>
11244-
1124511219
<varlistentry id="guc-trace-sort" xreflabel="trace_sort">
1124611220
<term><varname>trace_sort</varname> (<type>boolean</type>)
1124711221
<indexterm>

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7213,7 +7213,7 @@ RecoveryRestartPoint(const CheckPoint *checkPoint, XLogReaderState *record)
72137213
*/
72147214
if (XLogHaveInvalidPages())
72157215
{
7216-
elog(trace_recovery(DEBUG2),
7216+
elog(DEBUG2,
72177217
"could not record restart point at %X/%X because there "
72187218
"are unresolved references to invalid pages",
72197219
LSN_FORMAT_ARGS(checkPoint->redo));

src/backend/access/transam/xlogrecovery.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,9 +1704,7 @@ PerformWalRecovery(void)
17041704
LSN_FORMAT_ARGS(xlogreader->ReadRecPtr));
17051705

17061706
#ifdef WAL_DEBUG
1707-
if (XLOG_DEBUG ||
1708-
(record->xl_rmid == RM_XACT_ID && trace_recovery_messages <= DEBUG2) ||
1709-
(record->xl_rmid != RM_XACT_ID && trace_recovery_messages <= DEBUG3))
1707+
if (XLOG_DEBUG)
17101708
{
17111709
StringInfoData buf;
17121710

src/backend/storage/ipc/procarray.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,11 +1109,11 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
11091109
running->oldestRunningXid))
11101110
{
11111111
standbyState = STANDBY_SNAPSHOT_READY;
1112-
elog(trace_recovery(DEBUG1),
1112+
elog(DEBUG1,
11131113
"recovery snapshots are now enabled");
11141114
}
11151115
else
1116-
elog(trace_recovery(DEBUG1),
1116+
elog(DEBUG1,
11171117
"recovery snapshot waiting for non-overflowed snapshot or "
11181118
"until oldest active xid on standby is at least %u (now %u)",
11191119
standbySnapshotPendingXmin,
@@ -1208,7 +1208,7 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
12081208
KnownAssignedXidsAdd(xids[i], xids[i], true);
12091209
}
12101210

1211-
KnownAssignedXidsDisplay(trace_recovery(DEBUG3));
1211+
KnownAssignedXidsDisplay(DEBUG3);
12121212
}
12131213

12141214
pfree(xids);
@@ -1280,11 +1280,11 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running)
12801280

12811281
Assert(FullTransactionIdIsValid(TransamVariables->nextXid));
12821282

1283-
KnownAssignedXidsDisplay(trace_recovery(DEBUG3));
1283+
KnownAssignedXidsDisplay(DEBUG3);
12841284
if (standbyState == STANDBY_SNAPSHOT_READY)
1285-
elog(trace_recovery(DEBUG1), "recovery snapshots are now enabled");
1285+
elog(DEBUG1, "recovery snapshots are now enabled");
12861286
else
1287-
elog(trace_recovery(DEBUG1),
1287+
elog(DEBUG1,
12881288
"recovery snapshot waiting for non-overflowed snapshot or "
12891289
"until oldest active xid on standby is at least %u (now %u)",
12901290
standbySnapshotPendingXmin,
@@ -4339,7 +4339,7 @@ RecordKnownAssignedTransactionIds(TransactionId xid)
43394339
Assert(TransactionIdIsValid(xid));
43404340
Assert(TransactionIdIsValid(latestObservedXid));
43414341

4342-
elog(trace_recovery(DEBUG4), "record known xact %u latestObservedXid %u",
4342+
elog(DEBUG4, "record known xact %u latestObservedXid %u",
43434343
xid, latestObservedXid);
43444344

43454345
/*
@@ -4897,7 +4897,7 @@ KnownAssignedXidsRemove(TransactionId xid)
48974897
{
48984898
Assert(TransactionIdIsValid(xid));
48994899

4900-
elog(trace_recovery(DEBUG4), "remove KnownAssignedXid %u", xid);
4900+
elog(DEBUG4, "remove KnownAssignedXid %u", xid);
49014901

49024902
/*
49034903
* Note: we cannot consider it an error to remove an XID that's not
@@ -4951,13 +4951,13 @@ KnownAssignedXidsRemovePreceding(TransactionId removeXid)
49514951

49524952
if (!TransactionIdIsValid(removeXid))
49534953
{
4954-
elog(trace_recovery(DEBUG4), "removing all KnownAssignedXids");
4954+
elog(DEBUG4, "removing all KnownAssignedXids");
49554955
pArray->numKnownAssignedXids = 0;
49564956
pArray->headKnownAssignedXids = pArray->tailKnownAssignedXids = 0;
49574957
return;
49584958
}
49594959

4960-
elog(trace_recovery(DEBUG4), "prune KnownAssignedXids to %u", removeXid);
4960+
elog(DEBUG4, "prune KnownAssignedXids to %u", removeXid);
49614961

49624962
/*
49634963
* Mark entries invalid starting at the tail. Since array is sorted, we

src/backend/storage/ipc/standby.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,7 @@ StandbyAcquireAccessExclusiveLock(TransactionId xid, Oid dbOid, Oid relOid)
997997
TransactionIdDidAbort(xid))
998998
return;
999999

1000-
elog(trace_recovery(DEBUG4),
1001-
"adding recovery lock: db %u rel %u", dbOid, relOid);
1000+
elog(DEBUG4, "adding recovery lock: db %u rel %u", dbOid, relOid);
10021001

10031002
/* dbOid is InvalidOid when we are locking a shared relation. */
10041003
Assert(OidIsValid(relOid));
@@ -1042,7 +1041,7 @@ StandbyReleaseXidEntryLocks(RecoveryLockXidEntry *xidentry)
10421041
{
10431042
LOCKTAG locktag;
10441043

1045-
elog(trace_recovery(DEBUG4),
1044+
elog(DEBUG4,
10461045
"releasing recovery lock: xid %u db %u rel %u",
10471046
entry->key.xid, entry->key.dbOid, entry->key.relOid);
10481047
/* Release the lock ... */
@@ -1109,7 +1108,7 @@ StandbyReleaseAllLocks(void)
11091108
HASH_SEQ_STATUS status;
11101109
RecoveryLockXidEntry *entry;
11111110

1112-
elog(trace_recovery(DEBUG2), "release all standby locks");
1111+
elog(DEBUG2, "release all standby locks");
11131112

11141113
hash_seq_init(&status, RecoveryLockXidHash);
11151114
while ((entry = hash_seq_search(&status)))
@@ -1369,15 +1368,15 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts)
13691368
recptr = XLogInsert(RM_STANDBY_ID, XLOG_RUNNING_XACTS);
13701369

13711370
if (CurrRunningXacts->subxid_overflow)
1372-
elog(trace_recovery(DEBUG2),
1371+
elog(DEBUG2,
13731372
"snapshot of %d running transactions overflowed (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
13741373
CurrRunningXacts->xcnt,
13751374
LSN_FORMAT_ARGS(recptr),
13761375
CurrRunningXacts->oldestRunningXid,
13771376
CurrRunningXacts->latestCompletedXid,
13781377
CurrRunningXacts->nextXid);
13791378
else
1380-
elog(trace_recovery(DEBUG2),
1379+
elog(DEBUG2,
13811380
"snapshot of %d+%d running transaction ids (lsn %X/%X oldest xid %u latest complete %u next xid %u)",
13821381
CurrRunningXacts->xcnt, CurrRunningXacts->subxcnt,
13831382
LSN_FORMAT_ARGS(recptr),

src/backend/utils/cache/inval.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -966,13 +966,12 @@ ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs,
966966
if (nmsgs <= 0)
967967
return;
968968

969-
elog(trace_recovery(DEBUG4), "replaying commit with %d messages%s", nmsgs,
969+
elog(DEBUG4, "replaying commit with %d messages%s", nmsgs,
970970
(RelcacheInitFileInval ? " and relcache file invalidation" : ""));
971971

972972
if (RelcacheInitFileInval)
973973
{
974-
elog(trace_recovery(DEBUG4), "removing relcache init files for database %u",
975-
dbid);
974+
elog(DEBUG4, "removing relcache init files for database %u", dbid);
976975

977976
/*
978977
* RelationCacheInitFilePreInvalidate, when the invalidation message

src/backend/utils/error/elog.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,29 +3759,3 @@ write_stderr_signal_safe(const char *str)
37593759
nwritten += rc;
37603760
}
37613761
}
3762-
3763-
3764-
/*
3765-
* Adjust the level of a recovery-related message per trace_recovery_messages.
3766-
*
3767-
* The argument is the default log level of the message, eg, DEBUG2. (This
3768-
* should only be applied to DEBUGn log messages, otherwise it's a no-op.)
3769-
* If the level is >= trace_recovery_messages, we return LOG, causing the
3770-
* message to be logged unconditionally (for most settings of
3771-
* log_min_messages). Otherwise, we return the argument unchanged.
3772-
* The message will then be shown based on the setting of log_min_messages.
3773-
*
3774-
* Intention is to keep this for at least the whole of the 9.0 production
3775-
* release, so we can more easily diagnose production problems in the field.
3776-
* It should go away eventually, though, because it's an ugly and
3777-
* hard-to-explain kluge.
3778-
*/
3779-
int
3780-
trace_recovery(int trace_level)
3781-
{
3782-
if (trace_level < LOG &&
3783-
trace_level >= trace_recovery_messages)
3784-
return LOG;
3785-
3786-
return trace_level;
3787-
}

src/backend/utils/misc/guc_tables.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ int log_parameter_max_length_on_error = 0;
525525
int log_temp_files = -1;
526526
double log_statement_sample_rate = 1.0;
527527
double log_xact_sample_rate = 0;
528-
int trace_recovery_messages = LOG;
529528
char *backtrace_functions;
530529

531530
int temp_file_limit = -1;
@@ -4780,23 +4779,6 @@ struct config_enum ConfigureNamesEnum[] =
47804779
NULL, NULL, NULL
47814780
},
47824781

4783-
{
4784-
{"trace_recovery_messages", PGC_SIGHUP, DEVELOPER_OPTIONS,
4785-
gettext_noop("Enables logging of recovery-related debugging information."),
4786-
gettext_noop("Each level includes all the levels that follow it. The later"
4787-
" the level, the fewer messages are sent."),
4788-
GUC_NOT_IN_SAMPLE,
4789-
},
4790-
&trace_recovery_messages,
4791-
4792-
/*
4793-
* client_message_level_options allows too many values, really, but
4794-
* it's not worth having a separate options array for this.
4795-
*/
4796-
LOG, client_message_level_options,
4797-
NULL, NULL, NULL
4798-
},
4799-
48004782
{
48014783
{"track_functions", PGC_SUSET, STATS_CUMULATIVE,
48024784
gettext_noop("Collects function-level statistics on database activity."),

src/include/miscadmin.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ extern void PreventCommandIfReadOnly(const char *cmdname);
302302
extern void PreventCommandIfParallelMode(const char *cmdname);
303303
extern void PreventCommandDuringRecovery(const char *cmdname);
304304

305-
/* in utils/misc/guc_tables.c */
306-
extern PGDLLIMPORT int trace_recovery_messages;
307-
extern int trace_recovery(int trace_level);
308-
309305
/*****************************************************************************
310306
* pdir.h -- *
311307
* POSTGRES directory path definitions. *

0 commit comments

Comments
 (0)