pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jesper St John <jesper@stjohn.se>
To: Zsolt Parragi <zsolt.parragi@percona.com>
Cc: pgsql-bugs@lists.postgresql.org
Cc: Jesper St John <admin@zonezero.se>
Cc: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Kirill Reshke <reshkekirill@gmail.com>
Subject: Re: Timing issue in pg_basebackup
Date: Tue, 24 Nov 2026 14:06:31 +0100
Message-ID: <d665de0d6ef174829817d7b197563446@stjohn.se> (raw)
In-Reply-To: <CAN4CZFPPX6T4HZe8OK=TaZQG216bMxpbuc5O6aibRBj2VGULfw@mail.gmail.com>
References: <ddfa03dcf26f366ae493e8cc41bd479a@stjohn.se>
	<CALdSSPj_M=6RLR0XpXKVr_NWiaVAhT7g7wRaMx_--3kKZpT0SA@mail.gmail.com>
	<4417791388e8f1df20f64013e944be8e@stjohn.se>
	<CALdSSPg2hY=8SLZRk-o22oUAd=af7oNEXRJf8coTf-hjOtRg-A@mail.gmail.com>
	<80143a07e6732576c9f815a3058fa31d@stjohn.se>
	<CAN4CZFMbAcw4DZ-07PC9vt0tKVo0iaRvjswrs-bX19AfyY4vBg@mail.gmail.com>
	<CABUevEyyZqej1VS=JNhCgXJQP+2-VHYQccnXz079k=7c_7Wqsw@mail.gmail.com>
	<4E8EC951-B75E-4CB8-97B6-D5C21F88A991@yandex-team.ru>
	<4F71E8F4-32D9-4B37-9DA9-203564F00692@zonezero.se>
	<4fdcbef083932d15d6d03c4fd9076e42@stjohn.se>
	<CAN4CZFMcG9v5os=m+NWhgorDt-cCiBBWFwq3atEGoUH24d-0PQ@mail.gmail.com>
	<bb286c1c536866fc3b18f632dc90ee10@stjohn.se>
	<CAN4CZFPPX6T4HZe8OK=TaZQG216bMxpbuc5O6aibRBj2VGULfw@mail.gmail.com>

On 2026-11-23 23:16, Zsolt Parragi wrote:
> On Mon, 23 Nov 2026, Jesper St John <jesper@stjohn.se> wrote:
>> But it seems that in master today, a previously created slot which 
>> would
>> be specified by --slot and not --create-slot could also be invalidated
>> if a tiny idle_replication_slot_timeout is set.
> 
> It seems like a new behavior to me with --create-slot (I agree that it
> is preexisting with --slot).

Ok, fair. I think the idle_replication_slot_timeout needs some more 
documentation though.

> 
> Also, --create-slot leaves the slot behind in this case, which is also
> new. And this happens in two more cases: when the connection is lost
> and when the process is killed with SIGINT/SIGTERM during the
> checkpoint.
> 
Yes.

> The new hint can also be misleading in some cases:
> 
> PGOPTIONS='-c idle_session_timeout=2s' pg_basebackup -X stream
> --checkpoint=spread   (no slot invalidated in the server log)
> pg_basebackup: warning: replication slot "pg_basebackup_664448" was
> invalidated during the base backup checkpoint, recreating it
> pg_basebackup: hint: You might need to increase 
> "max_slot_wal_keep_size".
> 
> I am not sure if this is bad or not, because that is probably the more
> common case of why is this happening, and the hint says 'might', so it
> might be okay.
It can be rephrased.

What if we create a temp slot before running base backup and then drop 
it and create a new slot if needed as it is done today? That way it 
shouldn't be hit by idle_replication_slot_timeout and any sigint/sigterm 
would not leave the slot behind.

The patch might be smaller...

The idle_session_timeout of something smaller than the time it takes to 
do checkpoint=spread would probably recreate the timing issue with temp 
slot- so perhaps that could be overriden?

Any thoughts before I start exploring?

//Jesper






view thread (18+ messages)  latest in thread

Message-ID: <d665de0d6ef174829817d7b197563446@stjohn.se>
Permalink:  ../d665de0d6ef174829817d7b197563446@stjohn.se/
Also on:    postgresql.org/message-id/d665de0d6ef174829817d7b197563446@stjohn.se

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: jesper@stjohn.se, zsolt.parragi@percona.com, admin@zonezero.se, x4mmm@yandex-team.ru, magnus@hagander.net, reshkekirill@gmail.com
  Subject: Re: Timing issue in pg_basebackup
  In-Reply-To: <d665de0d6ef174829817d7b197563446@stjohn.se>
  References: <ddfa03dcf26f366ae493e8cc41bd479a@stjohn.se> <CALdSSPj_M=6RLR0XpXKVr_NWiaVAhT7g7wRaMx_--3kKZpT0SA@mail.gmail.com> <4417791388e8f1df20f64013e944be8e@stjohn.se> <CALdSSPg2hY=8SLZRk-o22oUAd=af7oNEXRJf8coTf-hjOtRg-A@mail.gmail.com> <80143a07e6732576c9f815a3058fa31d@stjohn.se> <CAN4CZFMbAcw4DZ-07PC9vt0tKVo0iaRvjswrs-bX19AfyY4vBg@mail.gmail.com> <CABUevEyyZqej1VS=JNhCgXJQP+2-VHYQccnXz079k=7c_7Wqsw@mail.gmail.com> <4E8EC951-B75E-4CB8-97B6-D5C21F88A991@yandex-team.ru> <4F71E8F4-32D9-4B37-9DA9-203564F00692@zonezero.se> <4fdcbef083932d15d6d03c4fd9076e42@stjohn.se> <CAN4CZFMcG9v5os=m+NWhgorDt-cCiBBWFwq3atEGoUH24d-0PQ@mail.gmail.com> <bb286c1c536866fc3b18f632dc90ee10@stjohn.se> <CAN4CZFPPX6T4HZe8OK=TaZQG216bMxpbuc5O6aibRBj2VGULfw@mail.gmail.com> <d665de0d6ef174829817d7b197563446@stjohn.se>

* 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