Thread: pgsql: Prevent use of invalidated logical slot in CreateDecodingContext

pgsql: Prevent use of invalidated logical slot in CreateDecodingContext

From
Andres Freund
Date:
Prevent use of invalidated logical slot in CreateDecodingContext()

Previously we had checks for this in multiple places. Support for logical
decoding on standbys will add other forms of invalidation, making it worth
while to centralize the checks.

This slightly changes the error message for both the walsender and SQL
interface. Particularly the SQL interface error was inaccurate, as the "This
slot has never previously reserved WAL" portion was unreachable.

Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4397abd0a2af955326c0608d63f3716ce5901004

Modified Files
--------------
src/backend/replication/logical/logical.c      | 16 ++++++++++++++++
src/backend/replication/logical/logicalfuncs.c | 13 -------------
src/backend/replication/walsender.c            |  7 -------
3 files changed, 16 insertions(+), 20 deletions(-)