Re: Synchronous Log Shipping Replication

From: "Fujii Masao" <masao(dot)fujii(at)gmail(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Heikki Linnakangas" <heikki(dot)linnakangas(at)enterprisedb(dot)com>, "Hannu Krosing" <hannu(at)krosing(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Markus Wanner" <markus(at)bluegap(dot)ch>, "ITAGAKI Takahiro" <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Synchronous Log Shipping Replication
Date: 2008-09-15 12:42:38
Message-ID: 3f0b79eb0809150542v1810915fy387528f46af973af@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 12, 2008 at 7:41 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>
> On Thu, 2008-09-11 at 18:17 +0300, Heikki Linnakangas wrote:
>> Fujii Masao wrote:
>> > I think that this case would often happen. So, we should establish a certain
>> > solution or procedure to the case where TLI of the master doesn't match
>> > TLI of the slave. If we only allow the case where TLI of both servers is the
>> > same, the configuration after failover always needs to get the base backup
>> > on the new master. It's unacceptable for many users. But, I think that it's
>> > the role of admin or external tools to copy history files to the slave from
>> > the master.
>>
>> Hmm. There's more problems than the TLI with that. For the original
>> master to catch up by replaying WAL from the new slave, without
>> restoring from a full backup, the original master must not write to disk
>> *any* WAL that hasn't made it to the slave yet. That is certainly not
>> true for asynchronous replication, but it also throws off the idea of
>> flushing the WAL concurrently to the local disk and to the slave in
>> synchronous mode.
>>
>> I agree that having to get a new base backup to get the old master catch
>> up with the new master sucks, so I hope someone sees a way around that.
>
> If we were going to recover from failed-over standby back to original
> master just via WAL logs we would need all of the WAL files from the
> point of failover. So you'd need to be storing all WAL file just in case
> the old master recovers. I can't believe doing that would be the common
> case, because its so impractical and most people would run out of disk
> space and need to delete WAL files.

No. The original master doesn't need all WAL files. It needs WAL file which
its pg_control points as latest checkpoint location and subsequent files.

> It should be clear that to make this work you must run with a base
> backup that was derived correctly on the current master. You can do that
> by re-copying everything, or you can do that by just shipping changed
> blocks (rsync etc). So I don't see a problem in the first place.

PITR doesn't always need a base backup. We can do PITR from the data
files just after crash if they aren't corrupted (i.e. not media crash).

As the situation demands, most users would like to choose the setup
procedure that bad influence on the cluster is smaller. They would choose
the procedure without a base backup if there are few WAL files to be
replayed. Meanwhile, they would use a base backup if the indispensable
WAL files have already been deleted. But, in that case, they might not take
new base backup and use old one (e.g. taken 2 days before).

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-15 12:52:18 Re: rmgr hooks and contrib/rmgr_hook
Previous Message Simon Riggs 2008-09-15 12:40:19 Re: Transaction Snapshots and Hot Standby