Re: Why restore_command is called for existing files in pg_xlog?

From: Alex Kliukin <alexk(at)hintbits(dot)com>
To: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why restore_command is called for existing files in pg_xlog?
Date: 2017-06-12 12:25:44
Message-ID: 1497270344.956665.1006527376.13E87DB6@webmail.messagingengine.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Fri, Jun 2, 2017, at 11:51 AM, Alexander Kukushkin wrote:
> Hello hackers,
> There is one strange and awful thing I don't understand about
> restore_command: it is always being called for every single WAL
> segment postgres wants to apply (even if such segment already exists
> in pg_xlog) until replica start streaming from the master.
The real problem this question is related to is being unable to bring a
former master, demoted after a crash, online, since the WAL segments
required to get it to the consistent state were not archived while it
was still a master, and local segments in pg_xlog are ignored when a
restore_command is defined. The other replicas wouldn't be good
candidates for promotion as well, as they were way behind the master
(because the last N WAL segments were not archived and streaming
replication had a few seconds delay).
Is this a correct list for such questions, or would it be more
appropriate to ask elsewhere (i.e. pgsql-bugs?)
>
> If there is no restore_command in the recovery.conf - it perfectly
> works, i.e. postgres replays existing wal segments and at some point
> connects to the master and start streaming from it.>
> When recovery_conf is there, starting of a replica could become a real
> problem, especially if restore_command is slow.>
> Is it possible to change this behavior somehow? First look into
> pg_xlog and only if file is missing or "corrupted" call
> restore_command.>
>
> Regards,
> ---
> Alexander Kukushkin

Sincerely,
Alex

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Achilleas Mantzios 2017-06-12 12:56:26 Re: ERROR: unexpected chunk number 0 (expected 1) for toast value 76753264 in pg_toast_10920100
Previous Message Olav Gjerde 2017-06-12 12:25:23 Timezone locale consistency for functional indexes

Browse pgsql-hackers by date

  From Date Subject
Next Message wangchuanting 2017-06-12 12:47:59 Re: BUG #14680: startup process on standby encounter a deadlock of TwoPhaseStateLock when redo 2PC xlog
Previous Message Andreas Karlsson 2017-06-12 11:58:30 Re: oidin / oidout and InvalidOid