Re: loss of transactions in streaming replication

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: loss of transactions in streaming replication
Date: 2011-10-19 12:44:37
Message-ID: CA+TgmoZ3_-assSrO9jLfnDZfepq3755kUbNe=_b-+y8THLL3oQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 19, 2011 at 2:31 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-10-19 12:45:25 Re: Separating bgwriter and checkpointer
Previous Message Dickson S. Guedes 2011-10-19 12:43:07 Re: Separating bgwriter and checkpointer