pg_basebackup: Allow setting replication slots in recovery.confeven if wal-method is none - Mailing list pgsql-hackers

From Michael Banck
Subject pg_basebackup: Allow setting replication slots in recovery.confeven if wal-method is none
Date
Msg-id 1521637500.15036.10.camel@credativ.de
Whole thread Raw
List pgsql-hackers
Hi,

per suggestion from my colleague Christoph Berg, it seems to make sense
to allow setting the (permanent) replication slot in recovery.conf even
if we don't stream WAL, i.e. allow

pg_basebackup -D foo -R --slot=foo -C -X none

Currently you get an error message "replication slots can only be used
with WAL streaming". If we don't write a recovery.conf, it indeed seems
a bit pointless to allow --slot with -X none, but it should not hurt
either I think.

As physical replication slots are currently created (if requested via
the -C option) in the walstreamer connection, their creation would have
to be moved to the main connection in BaseBackup(), while the temporary
slot creation needs to stay with the walstreamer connection. Peter
Eisentraut also suggested splitting it up like that in 6f0d2862-d33c-9ed
e-1fd2-fc99fc51a2c5@2ndquadrant.com 

The attached patch does that, and relaxes the check to allow --slot with
-X none as long as a recovery.conf is written.


Michael

-- 
Michael Banck
Projektleiter / Senior Berater
Tel.: +49 2166 9901-171
Fax:  +49 2166 9901-100
Email: michael.banck@credativ.de

credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer
Attachment

pgsql-hackers by date:

Previous
From: Michael Banck
Date:
Subject: Re: pg_basebackup: Missing newlines in some error messages
Next
From: Alvaro Herrera
Date:
Subject: Re: pg_basebackup: Missing newlines in some error messages