Re: confusing results from pg_get_replication_slots() - Mailing list pgsql-hackers

From Robert Haas
Subject Re: confusing results from pg_get_replication_slots()
Date
Msg-id CA+Tgmob+_Gtdi+r53AScr1JX0C7MfY9T8_iHNVKES=RA5sFxPA@mail.gmail.com
Whole thread Raw
In response to Re: confusing results from pg_get_replication_slots()  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
On Sat, Jan 3, 2026 at 9:52 AM Andrey Borodin <x4mmm@yandex-team.ru> wrote:
> Slot state is a mix of 3 values here: WAL reservation, WAL availability, xmin reservation.
> WAL reservation is 3-state value: "reserving", "extended reserving", "not reserving".
> WAL availability is binary. Always true if reserving.
> xmin reservation is binary, always true if WAL was continously available (or is it connected at all?).
>
> "unreserved" slot does not reserve WAL, but holds xmin. WAL must be avaliable.
> "lost" does not reserve WAL, and also does not hold xmin. WAL might be available, might be unavailable.
>
> Is it possible to report state of the slot consistently without race conditions?

I don't know. I think that on master we should seriously consider
reporting invalidated slots in some clearly-distinguishable way, e.g.
report "invalidated" rather than "lost". The fact that the slot is
invalidated means that whether or not the WAL is still available is a
moot point. In the back-branches, I think introducing a new possible
value of that column is too much, but I think that display "lost" is
clearly better than displaying "unreserved," since the only reason
that we ever do the latter is due to a weird exception that is
intended to catch race conditions which really makes no sense for an
invalidated slot, where recovery is not possible.

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: should we have a fast-path planning for OLTP starjoins?
Next
From: Kirill Reshke
Date:
Subject: Re: GIN pageinspect support for entry tree and posting tree