pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_rewind: Should abort if both --source-pgdata and --source-server are specified
2+ messages / 2 participants
[nested] [flat]
* pg_rewind: Should abort if both --source-pgdata and --source-server are specified
@ 2016-10-07 10:34 Michael Banck <michael.banck@credativ.de>
0 siblings, 1 reply; 2+ messages in thread
From: Michael Banck @ 2016-10-07 10:34 UTC (permalink / raw)
To: pgsql-hackers
Hi,
ISTM that pg_rewind's --source-pgdata and --source-server options are
mutually exclusive, and the synopsis in the documentation seems to
indicate that as well:
|pg_rewind [option...] {-D | --target-pgdata} directory
|{--source-pgdata=directory | --source-server=connstr}
However, there is no such check in the code.
I've seen people assume --source-pgdata is supposed to be the data
directory location on the remote server if they specify --source-server
as well, and are then confused by error messages.
So I think pg_rewind should abort in this case. Patch for that attached.
Thoughts?
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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Attachments:
pg_rewind.patch (text/x-diff, 634B) download
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 5fdd4c5..dd62dd0 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -162,6 +162,13 @@ main(int argc, char **argv)
exit(1);
}
+ if (datadir_source != NULL && connstr_source != NULL)
+ {
+ fprintf(stderr, _("%s: only one of --source-pgdata or --source-server can be specified\n"), progname);
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+ exit(1);
+ }
+
if (datadir_target == NULL)
{
fprintf(stderr, _("%s: no target data directory specified (--target-pgdata)\n"), progname);
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pg_rewind: Should abort if both --source-pgdata and --source-server are specified
@ 2016-10-07 11:39 Heikki Linnakangas <hlinnaka@iki.fi>
parent: Michael Banck <michael.banck@credativ.de>
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Linnakangas @ 2016-10-07 11:39 UTC (permalink / raw)
To: Michael Banck <michael.banck@credativ.de>; pgsql-hackers
On 10/07/2016 01:34 PM, Michael Banck wrote:
> Hi,
>
> ISTM that pg_rewind's --source-pgdata and --source-server options are
> mutually exclusive, and the synopsis in the documentation seems to
> indicate that as well:
>
> |pg_rewind [option...] {-D | --target-pgdata} directory
> |{--source-pgdata=directory | --source-server=connstr}
>
> However, there is no such check in the code.
>
> I've seen people assume --source-pgdata is supposed to be the data
> directory location on the remote server if they specify --source-server
> as well, and are then confused by error messages.
>
> So I think pg_rewind should abort in this case. Patch for that attached.
Agreed. Committed, thanks!
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-10-07 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 10:34 pg_rewind: Should abort if both --source-pgdata and --source-server are specified Michael Banck <michael.banck@credativ.de>
2016-10-07 11:39 ` Heikki Linnakangas <hlinnaka@iki.fi>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox