Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 400916b

Browse files
committed
emode_for_corrupt_record shouldn't reduce LOG messages to WARNING.
In non-interactive sessions, WARNING sorts below LOG.
1 parent ee37fb5 commit 400916b

File tree

1 file changed

+9
-28
lines changed
  • src/backend/access/transam

1 file changed

+9
-28
lines changed

src/backend/access/transam/xlog.c

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.426 2010/06/17 17:37:23 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.427 2010/06/28 19:46:19 rhaas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -9542,8 +9542,13 @@ XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt,
95429542
* in the current WAL page, previously read by XLogPageRead().
95439543
*
95449544
* 'emode' is the error mode that would be used to report a file-not-found
9545-
* or legitimate end-of-WAL situation. It is upgraded to WARNING or PANIC
9546-
* if a corrupt record is not expected at this point.
9545+
* or legitimate end-of-WAL situation. Generally, we use it as-is, but if
9546+
* we're retrying the exact same record that we've tried previously, only
9547+
* complain the first time to keep the noise down. However, we only do when
9548+
* reading from pg_xlog, because we don't expect any invalid records in archive
9549+
* or in records streamed from master. Files in the archive should be complete,
9550+
* and we should never hit the end of WAL because we stop and wait for more WAL
9551+
* to arrive before replaying it.
95479552
*
95489553
* NOTE: This function remembers the RecPtr value it was last called with,
95499554
* to suppress repeated messages about the same record. Only call this when
@@ -9555,31 +9560,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
95559560
{
95569561
static XLogRecPtr lastComplaint = {0, 0};
95579562

9558-
/*
9559-
* We don't expect any invalid records in archive or in records streamed
9560-
* from master. Files in the archive should be complete, and we should
9561-
* never hit the end of WAL because we stop and wait for more WAL to
9562-
* arrive before replaying it.
9563-
*
9564-
* In standby mode, throw a WARNING and keep retrying. If we're lucky
9565-
* it's a transient error and will go away by itself, and in any case
9566-
* it's better to keep the standby open for any possible read-only
9567-
* queries. We throw WARNING in PITR as well, which causes the recovery
9568-
* to end. That's questionable, you probably would want to abort the
9569-
* recovery if the archive is corrupt and investigate the situation.
9570-
* But that's the behavior we've always had, and it does make sense
9571-
* for tools like pg_standby that implement a standby mode externally.
9572-
*/
9573-
if (readSource == XLOG_FROM_STREAM || readSource == XLOG_FROM_ARCHIVE)
9574-
{
9575-
if (emode < WARNING)
9576-
emode = WARNING;
9577-
}
9578-
/*
9579-
* If we retry reading a record in pg_xlog, only complain on the first
9580-
* time to keep the noise down.
9581-
*/
9582-
else if (emode == LOG)
9563+
if (readSource == XLOG_FROM_PG_XLOG && emode == LOG)
95839564
{
95849565
if (XLByteEQ(RecPtr, lastComplaint))
95859566
emode = DEBUG1;

0 commit comments

Comments
 (0)