RE: Newly created replication slot may be invalidated by checkpoint - Mailing list pgsql-hackers

From Hayato Kuroda (Fujitsu)
Subject RE: Newly created replication slot may be invalidated by checkpoint
Date
Msg-id TY7PR01MB145544C7273B9E43215CBD849F584A@TY7PR01MB14554.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: Newly created replication slot may be invalidated by checkpoint  (vignesh C <vignesh21@gmail.com>)
List 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


pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Newly created replication slot may be invalidated by checkpoint
Next
From: Amit Kapila
Date:
Subject: Re: [PATCH] Fix typo in pgstat_replslot.c