Re: Inconsistent DB data in Streaming Replication - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Inconsistent DB data in Streaming Replication
Date
Msg-id CAHGQGwEEvc235sKxkYMQkcsPK3-U24GwbmVR3ih8jQnUgTNFag@mail.gmail.com
Whole thread Raw
In response to Inconsistent DB data in Streaming Replication  (Samrat Revagade <revagade.samrat@gmail.com>)
Responses Re: Inconsistent DB data in Streaming Replication
List pgsql-hackers
On Mon, Apr 8, 2013 at 7:34 PM, Samrat Revagade
<revagade.samrat@gmail.com> wrote:
>
> Hello,
>
> We have been trying to figure out possible solutions to the following problem in streaming replication Consider
followingscenario:
 
>
> If master receives commit command, it writes and flushes commit WAL records to the disk, It also writes and flushes
datapage related to this transaction.
 
>
> The master then sends WAL records to standby up to the commit WAL record. But before sending these records if
failoverhappens then,  old master is ahead of  standby which is now the new master in terms of DB data leading to
inconsistentdata .
 

Why do you think that the inconsistent data after failover happens is
problem? Because
it's one of the reasons why a fresh base backup is required when
starting old master as
new standby? If yes, I agree with you. I've often heard the complaints
about a backup
when restarting new standby. That's really big problem.

The timeline mismatch after failover was one of the reasons why a
backup is required.
But, thanks to Heikki's recent work, that's solved, i.e., the timeline
mismatch would be
automatically resolved when starting replication in 9.3. So, the
remaining problem is an
inconsistent database.

> One solution to avoid this situation is have the master send WAL records to standby and wait for ACK from standby
committingWAL files to disk and only after that commit data page related to this transaction on master.
 

You mean to make the master wait the data page write until WAL has been not only
flushed to disk but also replicated to the standby?

> The main drawback would be increased wait time for the client due to extra round trip to standby before master sends
ACKto client. Are there any other issues with this approach?
 

I think that you can introduce GUC specifying whether this extra check
is required to
avoid a backup when failback.

Regards,

--
Fujii Masao



pgsql-hackers by date:

Previous
From: Ants Aasma
Date:
Subject: Re: Inconsistent DB data in Streaming Replication
Next
From: Rodrigo Barboza
Date:
Subject: Re: Unrecognized type error (postgres 9.1.4)