Re: loss of transactions in streaming replication - Mailing list pgsql-hackers

From Robert Haas
Subject Re: loss of transactions in streaming replication
Date
Msg-id CA+TgmoZ3_-assSrO9jLfnDZfepq3755kUbNe=_b-+y8THLL3oQ@mail.gmail.com
Whole thread Raw
In response to Re: loss of transactions in streaming replication  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: loss of transactions in streaming replication  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
On Wed, Oct 19, 2011 at 2:31 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
>> My reading of the situation is that you're talking about a problem
>> that will only occur if, while the master is in the process of
>> shutting down, a network error occurs.
>
> No. This happens even if a network error doesn't occur. I can
> reproduce the issue by doing the following:
>
> 1. Set up streaming replication master and standby with archive
>   setting.
> 2. Run pgbench -i
> 3. Shuts down the master with fast mode.
>
> Then I can see that the latest WAL file in the master's pg_xlog
> doesn't exist in the standby's one. The WAL record which was
> lost was the shutdown checkpoint one.
>
> When smart or fast shutdown is requested, the master tries to
> write and send the WAL switch (if archiving is enabled) and
> shutdown checkpoint record. Because of the problem I described,
> the WAL switch record arrives at the standby but the shutdown
> checkpoint does not.

Oh, that's not good.

> The original behavior, in 9.0, is that all outstanding WAL are
> replicated to the standby when the master shuts down normally.
> But ISTM the behavior was changed unexpectedly in 9.1. So
> I think that it should be back-patched to 9.1 to revert the behavior
> to the original.

Which commit broke this?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: "Dickson S. Guedes"
Date:
Subject: Re: Separating bgwriter and checkpointer
Next
From: Robert Haas
Date:
Subject: Re: Separating bgwriter and checkpointer