pgsql: Refactor replication connection code of various pg_basebackup ut

Started by Andres Freundover 11 years ago6 messagescomitters
Jump to latest
#1Andres Freund
andres@anarazel.de

Refactor replication connection code of various pg_basebackup utilities.

Move some more code to manage replication connection command to
streamutil.c. A later patch will introduce replication slot via
pg_receivexlog and this avoid duplicating relevant code between
pg_receivexlog and pg_recvlogical.

Author: Michael Paquier, with some editing by me.

Branch
------
master

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

Modified Files
--------------
src/bin/pg_basebackup/pg_basebackup.c | 21 +---
src/bin/pg_basebackup/pg_receivexlog.c | 38 ++-----
src/bin/pg_basebackup/pg_recvlogical.c | 116 +++++----------------
src/bin/pg_basebackup/streamutil.c | 177 +++++++++++++++++++++++++++++++-
src/bin/pg_basebackup/streamutil.h | 11 ++
5 files changed, 222 insertions(+), 141 deletions(-)

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

#2Stephen Frost
sfrost@snowman.net
In reply to: Andres Freund (#1)
Re: pgsql: Refactor replication connection code of various pg_basebackup ut

All,

* Andres Freund (andres@anarazel.de) wrote:

Refactor replication connection code of various pg_basebackup utilities.

Move some more code to manage replication connection command to
streamutil.c. A later patch will introduce replication slot via
pg_receivexlog and this avoid duplicating relevant code between
pg_receivexlog and pg_recvlogical.

Coverity is complaining that the new Create/DropReplicatSlot functions
leak, which is technically correct (though the cases where that happens
end up being more-or-les immediate-exit cases anyway). In any case,
here's a patch to clean up things prior to return.

Thanks,

Stephen

Attachments:

streamutil-cleanup.patchtext/x-diff; charset=us-asciiDownload+22-0
#3Andres Freund
andres@anarazel.de
In reply to: Stephen Frost (#2)
Re: pgsql: Refactor replication connection code of various pg_basebackup ut

On 2014-10-05 09:49:31 -0400, Stephen Frost wrote:

All,

* Andres Freund (andres@anarazel.de) wrote:

Refactor replication connection code of various pg_basebackup utilities.

Move some more code to manage replication connection command to
streamutil.c. A later patch will introduce replication slot via
pg_receivexlog and this avoid duplicating relevant code between
pg_receivexlog and pg_recvlogical.

Coverity is complaining that the new Create/DropReplicatSlot functions
leak, which is technically correct (though the cases where that happens
end up being more-or-les immediate-exit cases anyway). In any case,
here's a patch to clean up things prior to return.

I can't get very excited about this - but I also have no problems fixing
it. I'm fine with you committing what you have. Or would you rather have
me do it?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

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

#4Stephen Frost
sfrost@snowman.net
In reply to: Andres Freund (#3)
Re: pgsql: Refactor replication connection code of various pg_basebackup ut

* Andres Freund (andres@anarazel.de) wrote:

On 2014-10-05 09:49:31 -0400, Stephen Frost wrote:

Move some more code to manage replication connection command to
streamutil.c. A later patch will introduce replication slot via
pg_receivexlog and this avoid duplicating relevant code between
pg_receivexlog and pg_recvlogical.

Coverity is complaining that the new Create/DropReplicatSlot functions
leak, which is technically correct (though the cases where that happens
end up being more-or-les immediate-exit cases anyway). In any case,
here's a patch to clean up things prior to return.

I can't get very excited about this - but I also have no problems fixing
it.

Ok, great.

I'm fine with you committing what you have. Or would you rather have
me do it?

I'll do it in a few hours. I'm playing w/ pg_recvlogical. ;)

Thanks!

Stephen

#5Michael Paquier
michael@paquier.xyz
In reply to: Stephen Frost (#2)
Re: Re: pgsql: Refactor replication connection code of various pg_basebackup ut

On Sun, Oct 5, 2014 at 10:49 PM, Stephen Frost <sfrost@snowman.net> wrote:

Coverity is complaining that the new Create/DropReplicatSlot functions
leak, which is technically correct (though the cases where that happens
end up being more-or-les immediate-exit cases anyway). In any case,
here's a patch to clean up things prior to return.

Oops. Thanks for spotting that.
--
Michael

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

#6Stephen Frost
sfrost@snowman.net
In reply to: Andres Freund (#3)
Re: pgsql: Refactor replication connection code of various pg_basebackup ut

* Andres Freund (andres@anarazel.de) wrote:

I can't get very excited about this - but I also have no problems fixing
it. I'm fine with you committing what you have. Or would you rather have
me do it?

Done.

Thanks!

Stephen