Re: 9.2.3 crashes during archive recovery - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: 9.2.3 crashes during archive recovery
Date
Msg-id 20130306.141422.147305738.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: 9.2.3 crashes during archive recovery  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List pgsql-hackers
Hi, I suppose the attached patch is close to the solution.

> I think that this is an original intention of Heikki's patch.

I noticed that archive recovery will be turned on in
next_record_is_invalid thanks to your patch.

> On the other hand, your patch fixes that point but ReadRecord
> runs on the false page data. However the wrong record on the
> false page can be identified as broken, It should be an
> undesiable behavior.

All we should do to update minRecoveryPoint as needed when
XLogPageRead is failed in ReadRecord is to simply jump to
next_record_is_invalid if archive recovery is requested but doing
crash recovery yet.

Your modification in readTimeLineHistory and my modifictions in
XLogPageRead seem not necessary for the objective in this thread,
so removed.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 92adc4e..28d6f2e 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4010,7 +4010,15 @@ ReadRecord(XLogRecPtr *RecPtr, int emode, bool fetching_ckpt)retry:    /* Read the page
containingthe record */    if (!XLogPageRead(RecPtr, emode, fetching_ckpt, randAccess))
 
+    {
+        /*
+         * If archive recovery was requested when crash recovery failed, go to
+         * the label next_record_is_invalid to switch to archive recovery.
+         */
+        if (!InArchiveRecovery && ArchiveRecoveryRequested)
+            goto next_record_is_invalid;        return NULL;
+    }    pageHeaderSize = XLogPageHeaderSize((XLogPageHeader) readBuf);    targetRecOff = RecPtr->xrecoff %
XLOG_BLCKSZ;

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Request for vote to move forward with recovery.conf overhaul
Next
From: Heikki Linnakangas
Date:
Subject: Re: 9.2.3 crashes during archive recovery