Re: Standby trying "restore_command" before local WAL

From: Sergei Kornilov <sk(at)zsrv(dot)org>
To: Stephen Frost <sfrost(at)snowman(dot)net>, Emre Hasegeli <emre(at)hasegeli(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "berge(at)trivini(dot)no" <berge(at)trivini(dot)no>, Gürkan Gür <ben(at)gurkan(dot)in>, Raimund Schlichtiger <raimund(dot)schlichtiger(at)innogames(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Bernhard Schrader <bernhard(dot)schrader(at)innogames(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Vik Fearing <vik(at)2ndquadrant(dot)fr>
Subject: Re: Standby trying "restore_command" before local WAL
Date: 2018-07-31 16:39:24
Message-ID: 27173531533055165@sas2-5d23d1328f85.qloud-c.yandex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

> As mentioned by others, it sounds like we could have an option to try
> contacting the primary before running restore_commnad
Why about primary?
If we have restore_command on slave (or during point in time recovery) - we force using XLOG_FROM_ARCHIVE, even if XLOG_FROM_PG_WAL source can provide next WAL. As say xlog.c comment [1]:

> * We just successfully read a file in pg_wal. We prefer files in
> * the archive over ones in pg_wal, so try the next file again
> * from the archive first.

We have some actual reason why we prefer restore_command instead of using local wal files first?
Partially written WAL? Streaming replication can leave partially written WAL and we can handle this correctly.

Later (in XLogFileReadAnyTLI caller) we change XLOG_FROM_ARCHIVE to XLOG_FROM_ANY, but we force call XLOG_FROM_ARCHIVE first and then look in XLOG_FROM_PG_WAL. Or i am wrong?

regards, Sergei

[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/transam/xlog.c;h=493f1db7b97a94b882382fc3d2112634f56c86a3;hb=refs/heads/master#l12113

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan S. Katz 2018-07-31 16:50:57 PostgreSQL 11 Beta 3 Release: 2018-08-09
Previous Message Stephen Frost 2018-07-31 15:56:45 Re: Standby trying "restore_command" before local WAL