7
7
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
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 $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -9542,8 +9542,13 @@ XLogPageRead(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt,
9542
9542
* in the current WAL page, previously read by XLogPageRead().
9543
9543
*
9544
9544
* '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.
9547
9552
*
9548
9553
* NOTE: This function remembers the RecPtr value it was last called with,
9549
9554
* to suppress repeated messages about the same record. Only call this when
@@ -9555,31 +9560,7 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
9555
9560
{
9556
9561
static XLogRecPtr lastComplaint = {0 , 0 };
9557
9562
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 )
9583
9564
{
9584
9565
if (XLByteEQ (RecPtr , lastComplaint ))
9585
9566
emode = DEBUG1 ;
0 commit comments