Inconsistent DB data in Streaming Replication

From: Samrat Revagade <revagade(dot)samrat(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Inconsistent DB data in Streaming Replication
Date: 2013-04-08 10:34:21
Message-ID: CAF8Q-Gxg3PQTf71NVECe-6OzRaew5pWhk7yQtbJgWrFu513s+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

We have been trying to figure out possible solutions to the following
problem in streaming replication Consider following scenario:

If master receives commit command, it writes and flushes commit WAL records
to the disk, It also writes and flushes data page related to this
transaction.

The master then sends WAL records to standby up to the commit WAL record.
But before sending these records if failover happens then, old master is
ahead of standby which is now the new master in terms of DB data leading
to inconsistent data .

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

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

Thank you,

Samrat

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2013-04-08 12:56:32 Re: WIP: index support for regexp search
Previous Message Etsuro Fujita 2013-04-08 09:55:27 Re: Patch for removng unused targets