Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 70fd0e1

Browse files
committed
Don't start to stream after pg_receivexlog --create-slot.
Immediately starting to stream after --create-slot is inconvenient in a number of situations (e.g. when configuring a slot for use in recovery.conf) and it's easy to just call pg_receivexlog twice in the rest of the cases. Author: Michael Paquier Discussion: CAB7nPqQ9qEtuDiKY3OpNzHcz5iUA+DUX9FcN9K8GUkCZvG7+Ew@mail.gmail.com Backpatch: 9.5, where the option was introduced
1 parent 1e3e1ae commit 70fd0e1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/src/sgml/ref/pg_receivexlog.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ PostgreSQL documentation
273273
<listitem>
274274
<para>
275275
Create a new physical replication slot with the name specified in
276-
<option>--slot</option>, then start to stream WAL.
276+
<option>--slot</option>, then exit.
277277
</para>
278278
</listitem>
279279
</varlistentry>

src/bin/pg_basebackup/pg_receivexlog.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ main(int argc, char **argv)
508508
/*
509509
* Required arguments
510510
*/
511-
if (basedir == NULL && !do_drop_slot)
511+
if (basedir == NULL && !do_drop_slot && !do_create_slot)
512512
{
513513
fprintf(stderr, _("%s: no target directory specified\n"), progname);
514514
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
@@ -519,7 +519,7 @@ main(int argc, char **argv)
519519
/*
520520
* Check existence of destination folder.
521521
*/
522-
if (!do_drop_slot)
522+
if (!do_drop_slot && !do_create_slot)
523523
{
524524
DIR *dir = get_destination_dir(basedir);
525525

@@ -584,6 +584,7 @@ main(int argc, char **argv)
584584
if (!CreateReplicationSlot(conn, replication_slot, NULL, true,
585585
slot_exists_ok))
586586
disconnect_and_exit(1);
587+
disconnect_and_exit(0);
587588
}
588589

589590
/*

0 commit comments

Comments
 (0)