Why restore_command is called for existing files in pg_xlog?

From: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Why restore_command is called for existing files in pg_xlog?
Date: 2017-06-02 09:51:04
Message-ID: CAFh8B==69ozKHbBy8hq_efM7ihvSdc+BU-iHcmbn=ZBJoyBQHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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.

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Osahon Oduware 2017-06-02 09:52:38 PostGIS ST_CreateOverview Function For Non-Public Schema
Previous Message Pavel Stehule 2017-06-02 09:33:52 Re: Oracle database into PostgreSQL using Ora2PG tool.

Browse pgsql-hackers by date

  From Date Subject
Next Message Rafia Sabih 2017-06-02 10:42:22 Re: Default Partition for Range
Previous Message Magnus Hagander 2017-06-02 09:18:58 Re: comment fix in attoptcache.c