Re: Standby trying "restore_command" before local WAL

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Emre Hasegeli <emre(at)hasegeli(dot)com>, Sergei Kornilov <sk(at)zsrv(dot)org>, "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-08-06 15:19:23
Message-ID: 20180806151923.GK27724@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* David Steele (david(at)pgmasters(dot)net) wrote:
> I think for the stated scenario (known good standby that has been
> shutdown gracefully) it makes perfect sense to trust the contents of
> pg_wal. Call this scenario #1.
>
> An alternate scenario (#2) is that the data directory was copied using a
> basic copy tool and the pg_wal directory was not excluded from the copy.
> This means the contents of pg_wal will be in an inconsistent state.
> The files that are there might be partials (not with the extension,
> though) and you can easily have multiple partials. You will almost
> certainly not have everything you need to get to consistency.
>
> But there's another good scenario (#3): where the pg_wal directory was
> preloaded with all the WAL required to make the cluster consistent or
> all the WAL that was available at restore time. In this case, it would
> be make sense to prefer the contents of pg_wal and only switch to
> restore_command after that has been exhausted.
>
> So, the choice of whether to prefer locally-stored or
> restore_command-fetched WAL is context-dependent, in my mind.

Agreed.

> Ideally we could have a default that is safe in each scenario with
> perhaps an override if the user knows better. Scenario #1 would allow
> WAL to be read from pg_wal by default, scenario #2 would prefer fetched
> WAL, and scenario #3 could use a GUC to override the default fetch behavior.

Not sure how we'd be able to automatically realize which scenario we're
in though..?

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Curt Tilmes 2018-08-06 15:20:31 Re: [PATCH] Find additional connection service files in pg_service.conf.d directory
Previous Message Charles Cui 2018-08-06 15:03:23 Re: [GSoC]The project summary