Re: write ahead logging in standby (streaming replication) - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: write ahead logging in standby (streaming replication)
Date
Msg-id 3f0b79eb0911112031w6bf54d80r89957de9f90c6487@mail.gmail.com
Whole thread Raw
In response to Re: write ahead logging in standby (streaming replication)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: write ahead logging in standby (streaming replication)
Re: write ahead logging in standby (streaming replication)
List pgsql-hackers
On Thu, Nov 12, 2009 at 12:03 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Fujii Masao <masao.fujii@gmail.com> writes:
>> Should the standby also have to follow the WAL rule during recovery?
>> The current patch doesn't care about the write order of the data page
>> and WAL in the standby. So, after both servers fail, restarting the
>> ex-standby by itself might corrupt the data.
>
> Surely the receiver should fsync the WAL itself to disk before
> acknowledging it.  Assuming you've done that, I don't see any
> corruption risk.

"acknowledging it" means "letting the startup process know the arrival
of WAL records"? If so, I agree that there is no risk of data corruption.

The problem is that fsync needs to be issued too frequently, which would
be harmless in asynchronous replication, but not in synchronous one.
A transaction would have to wait for the primary's and standby's fsync
before returning a "success" to a client.

So I'm inclined to change the startup process and bgwriter, instead of
walreceiver, so as to fsync the WAL for the WAL rule.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: Listen / Notify rewrite
Next
From: "A.M."
Date:
Subject: Re: Listen / Notify rewrite