Re: Allow WAL information to recover corrupted pg_controldata - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allow WAL information to recover corrupted pg_controldata
Date
Msg-id 4274.1340084598@sss.pgh.pa.us
Whole thread Raw
In response to Re: Allow WAL information to recover corrupted pg_controldata  (Amit Kapila <amit.kapila@huawei.com>)
Responses Re: Allow WAL information to recover corrupted pg_controldata
Re: Allow WAL information to recover corrupted pg_controldata
Re: Allow WAL information to recover corrupted pg_controldata
List pgsql-hackers
Amit Kapila <amit.kapila@huawei.com> writes:
>> AFAIR you can create pg_control from scratch already with pg_resetxlog.
>> The hard part is coming up with values for the counters, such as the
>> next WAL location.  Some of them such as next OID are pretty harmless
>> if you don't guess right, but I'm worried that wrong next WAL could
>> make things worse not better.

> I believe if WAL files are proper as mentioned in Alvaro's mail, the
> purposed logic should generate correct values.

I've got a problem with the assumption that, when pg_control is trash,
megabytes or gigabytes of WAL can still be relied on completely.

I'm almost inclined to suggest that we not get next-LSN from WAL, but
by scanning all the pages in the main data store and computing the max
observed LSN.  This is clearly not very attractive from a performance
standpoint, but it would avoid the obvious failure mode where you lost
some recent WAL segments along with pg_control.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Kupershmidt
Date:
Subject: Re: patch: autocomplete for functions
Next
From: Tom Lane
Date:
Subject: Re: Transactions over pathological TCP connections