pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Optionally don't error out due to preexisting slots in commandli
4+ messages / 2 participants
[nested] [flat]

* pgsql: Optionally don't error out due to preexisting slots in commandli
@ 2015-07-12 20:17  Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 4+ messages in thread

From: Andres Freund @ 2015-07-12 20:17 UTC (permalink / raw)
  To: pgsql-committers

Optionally don't error out due to preexisting slots in commandline utilities.

pg_receivexlog and pg_recvlogical error out when --create-slot is
specified and a slot with the same name already exists. In some cases,
especially with pg_receivexlog, that's rather annoying and requires
additional scripting.

Backpatch to 9.5 as slot control functions have newly been added to
pg_receivexlog, and there doesn't seem much point leaving it in a less
useful state.

Discussion: 20150619144755.GG29350@alap3.anarazel.de

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ff27db5dd2fc096d89d3f995d3f650ec6d3bc147

Modified Files
--------------
doc/src/sgml/ref/pg_receivexlog.sgml   |   10 ++++++++
doc/src/sgml/ref/pg_recvlogical.sgml   |   10 ++++++++
src/bin/pg_basebackup/pg_receivexlog.c |   11 ++++++--
src/bin/pg_basebackup/pg_recvlogical.c |    9 ++++++-
src/bin/pg_basebackup/streamutil.c     |   44 ++++++++++++++------------------
src/bin/pg_basebackup/streamutil.h     |    4 +--
6 files changed, 58 insertions(+), 30 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Optionally don't error out due to preexisting slots in commandli
@ 2015-07-12 20:17  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2015-07-12 20:17 UTC (permalink / raw)
  To: pgsql-committers

Optionally don't error out due to preexisting slots in commandline utilities.

pg_receivexlog and pg_recvlogical error out when --create-slot is
specified and a slot with the same name already exists. In some cases,
especially with pg_receivexlog, that's rather annoying and requires
additional scripting.

Backpatch to 9.5 as slot control functions have newly been added to
pg_receivexlog, and there doesn't seem much point leaving it in a less
useful state.

Discussion: 20150619144755.GG29350@alap3.anarazel.de

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0e8e48b0da6ea00f3dbcb659542b0c81a97d1253

Modified Files
--------------
doc/src/sgml/ref/pg_receivexlog.sgml   |   10 ++++++++
doc/src/sgml/ref/pg_recvlogical.sgml   |   10 ++++++++
src/bin/pg_basebackup/pg_receivexlog.c |   11 ++++++--
src/bin/pg_basebackup/pg_recvlogical.c |    9 ++++++-
src/bin/pg_basebackup/streamutil.c     |   44 ++++++++++++++------------------
src/bin/pg_basebackup/streamutil.h     |    4 +--
6 files changed, 58 insertions(+), 30 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Optionally don't error out due to preexisting slots in commandli
@ 2015-08-12 06:09  Michael Paquier <michael.paquier@gmail.com>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 4+ messages in thread

From: Michael Paquier @ 2015-08-12 06:09 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers

On Mon, Jul 13, 2015 at 5:17 AM, Andres Freund <andres@anarazel.de> wrote:
> Optionally don't error out due to preexisting slots in commandline utilities.
>
> pg_receivexlog and pg_recvlogical error out when --create-slot is
> specified and a slot with the same name already exists. In some cases,
> especially with pg_receivexlog, that's rather annoying and requires
> additional scripting.
>
> Backpatch to 9.5 as slot control functions have newly been added to
> pg_receivexlog, and there doesn't seem much point leaving it in a less
> useful state.

Andres, Coverity is pointing out that this commit missed the shot when
sqlstate is NULL in CreateReplicationSlot and this would crash.
Something like the patch attached look adapted to me, vacuumdb.c doing
the necessary checks similarly.
Regards,
-- 
Michael

-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Attachments:

20150812_pgreceivexlog_state.patch (text/x-diff, 593B) download diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c index 91f919c..ccc6108 100644 --- a/src/bin/pg_basebackup/streamutil.c +++ b/src/bin/pg_basebackup/streamutil.c @@ -340,7 +340,9 @@ CreateReplicationSlot(PGconn *conn, const char *slot_name, const char *plugin, { const char *sqlstate = PQresultErrorField(res, PG_DIAG_SQLSTATE); - if (slot_exists_ok && strcmp(sqlstate, ERRCODE_DUPLICATE_OBJECT) == 0) + if (sqlstate && + slot_exists_ok && + strcmp(sqlstate, ERRCODE_DUPLICATE_OBJECT) == 0) { destroyPQExpBuffer(query); PQclear(res);
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: pgsql: Optionally don't error out due to preexisting slots in commandli
@ 2015-08-12 15:38  Andres Freund <andres@anarazel.de>
  parent: Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2015-08-12 15:38 UTC (permalink / raw)
  To: Michael Paquier <michael.paquier@gmail.com>; +Cc: pgsql-committers

On 2015-08-12 15:09:21 +0900, Michael Paquier wrote:
> Andres, Coverity is pointing out that this commit missed the shot when
> sqlstate is NULL in CreateReplicationSlot and this would crash.
> Something like the patch attached look adapted to me, vacuumdb.c doing
> the necessary checks similarly.

Thanks, fixed!


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2015-08-12 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-07-12 20:17 pgsql: Optionally don't error out due to preexisting slots in commandli Andres Freund <andres@anarazel.de>
2015-08-12 06:09 ` Michael Paquier <michael.paquier@gmail.com>
2015-08-12 15:38   ` Andres Freund <andres@anarazel.de>
2015-07-12 20:17 pgsql: Optionally don't error out due to preexisting slots in commandli Andres Freund <andres@anarazel.de>

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