RE: Newly created replication slot may be invalidated by checkpoint

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'vignesh C' <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, suyu(dot)cmj <mengjuan(dot)cmj(at)alibaba-inc(dot)com>, tomas <tomas(at)vondra(dot)me>, michael <michael(at)paquier(dot)xyz>, bharath(dot)rupireddyforpostgres <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Subject: RE: Newly created replication slot may be invalidated by checkpoint
Date: 2026-01-07 11:45:39
Message-ID: TY7PR01MB145544C7273B9E43215CBD849F584A@TY7PR01MB14554.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Vignesh,

> Here is a version which includes back branch version patches with
> pgindent changes. I have verified the following scenario in PG17,
> PG16, PG15 and PG14 branches and works as expected with the patches:

FYI, I also confirmed that the invalidation has not happened anymore with given
workload, for PG14+. Reserving a WAL record is protected by AllocationLock thus
concurrent read by checkpointer cannot happen.

```
+ if (XLogGetLastRemovedSegno() >= segno)
+ elog(ERROR, "WAL required by replication slot %s has been removed concurrently",
+ NameStr(slot->data.name));
```

Slightly I feel that we may be able to add a HINT to make sure user can retry
creating the slot.
But making them similar with HEAD is more important the code change.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-01-07 11:46:01 Re: [PATCH] Fix typo in pgstat_replslot.c
Previous Message Amit Kapila 2026-01-07 11:38:17 Re: Newly created replication slot may be invalidated by checkpoint