pg_basebackup --create-slot-if-not-exists?

From: Ashwin Agrawal <ashwinstar(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_basebackup --create-slot-if-not-exists?
Date: 2022-09-22 00:07:06
Message-ID: CAKSySweSHZn8pBbZ=e9BH33sOYhv-hXNO8C6V_UE7yK2QD_H1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Currently, pg_basebackup has
--create-slot option to create slot if not already exists or
--slot to use existing slot

Which means it needs knowledge on if the slot with the given name already
exists or not before invoking the command. If pg_basebackup --create-slot
<> command fails for some reason after creating the slot. Re-triggering the
same command fails with ERROR slot already exists. Either then need to
delete the slot and retrigger Or need to add a check before retriggering
the command to check if the slot exists and based on the same alter the
command to avoid passing --create-slot option. This poses
inconvenience while automating on top of pg_basebackup. As checking for
slot presence before invoking pg_basebackup unnecessarily involves issuing
separate SQL commands. Would be really helpful for such scenarios if
similar to CREATE TABLE, pg_basebackup can have IF NOT EXISTS kind of
semantic. (Seems the limitation most likely is coming from CREATE
REPLICATION SLOT protocol itself), Thoughts?

--
*Ashwin Agrawal (VMware)*

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-09-22 00:31:48 Re: pg_basebackup's --gzip switch misbehaves
Previous Message Jacob Champion 2022-09-21 23:37:58 Re: [PoC] Let libpq reject unexpected authentication requests