pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
To: Robert Haas <robertmhaas@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Sergei Kornilov <sk@zsrv.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Allow some recovery parameters to be changed with reload
Date: Thu, 22 Oct 2020 01:59:07 +0300
Message-ID: <1741c40b-73e3-133b-77e6-05ebc7bf3c0f@postgrespro.ru> (raw)
In-Reply-To: <CA+TgmobB4Syv3rh_v_QoyS=hMpw_Hf4JmjeOFQvDEQA8f2TFGw@mail.gmail.com>
References: <ca28011a-cfaa-565c-d622-c1907c33ecf7@2ndquadrant.com>
	<20190205033514.GC1882@paquier.xyz>
	<2317771549527294@sas2-985f744271ca.qloud-c.yandex.net>
	<5fc9ccea-9fd9-68a4-9d85-2fa1fd97ea7b@2ndquadrant.com>
	<20190208001931.GD19742@paquier.xyz>
	<20190208053146.apk5ts5ywvqrqmwv@alap3.anarazel.de>
	<3090621585393698@myt5-1466095fe4e5.qloud-c.yandex.net>
	<CA+TgmoZ9i4-ob0jE1i_ZV3g-ojCOxcEPYsNZ29fSXYVN+rMpsw@mail.gmail.com>
	<20200809052149.GB17986@paquier.xyz>
	<CA+TgmobB4Syv3rh_v_QoyS=hMpw_Hf4JmjeOFQvDEQA8f2TFGw@mail.gmail.com>

On 10.08.2020 23:20, Robert Haas wrote:
> On Sun, Aug 9, 2020 at 1:21 AM Michael Paquier <michael@paquier.xyz> wrote:
>> Sorry for the late reply.  I have been looking at that stuff again,
>> and restore_command can be called in the context of a WAL sender
>> process within the page_read callback of logical decoding via
>> XLogReadDetermineTimeline(), as readTimeLineHistory() could look for a
>> timeline history file.  So restore_command is not used only in the
>> startup process.
> Hmm, interesting. But, does that make this change wrong, apart from
> the comments? Like, in the case of primary_conninfo, maybe some
> confusion could result if the startup process decided whether to ask
> for a WAL receiver based on thinking primary_conninfo being set, while
> that process thought that it wasn't actually set after all, as
> previously discussed in
> http://postgr.es/m/CA+TgmoZVmJX1+QTWw2tSnPHrnkwKZxC3ZsRynFB-Fpzm1Oxuhw@mail.gmail.com
> ... but what's the corresponding hazard here, exactly? It doesn't seem
> that there's any way in which the decision one process makes affects
> the decision the other process makes. There's still a race condition:
> it's possible for a walsender
Did you mean walreceiver here?
>   to use the old restore_command after the
> startup process had already used the new one, or the other way around.
> However, it doesn't seem like that should confuse anything inside the
> server, and therefore I'm not sure we need to code around it.
I came up with following scenario. Let's say we have xlog files 1,2,3 in 
dir1 and files 4,5 in dir2. If startup process had only handled files 1 
and 2, before we switched restore_command from reading dir1 to reading 
dir2, it will fail to find next file. IIUC, it will assume that recovery 
is done, start server and walreceiver. The walreceiver will fail as 
well. I don't know, how realistic is this case, though.

In general,. this feature looks useful and consistent with previous 
changes, so I am interested in pushing it forward.
Sergey, could you please attach this thread to the upcoming CF, if 
you're going to continue working on it.

  A few more questions:
- RestoreArchivedFile() is also used by pg_rewind. I don't see any 
particular problem with it, just want to remind that we should test it too.
- How will it interact with possible future optimizations of archive 
restore? For example, WAL prefetch [1].

  [1] 
https://www.postgresql.org/message-id/flat/601EE1F5-0B78-47E1-9AAE-C15F74A1C21D@postgrespro.ru

-- 
Anastasia Lubennikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company






view thread (30+ messages)  latest in thread

Message-ID: <1741c40b-73e3-133b-77e6-05ebc7bf3c0f@postgrespro.ru>
Permalink:  ../1741c40b-73e3-133b-77e6-05ebc7bf3c0f@postgrespro.ru/
Also on:    postgresql.org/message-id/1741c40b-73e3-133b-77e6-05ebc7bf3c0f@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: a.lubennikova@postgrespro.ru, robertmhaas@gmail.com, michael@paquier.xyz, sk@zsrv.org, andres@anarazel.de, peter.eisentraut@2ndquadrant.com
  Subject: Re: Allow some recovery parameters to be changed with reload
  In-Reply-To: <1741c40b-73e3-133b-77e6-05ebc7bf3c0f@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox