Thread: pgsql: Add pg_recvlogical, a tool to receive data logical decoding data

pgsql: Add pg_recvlogical, a tool to receive data logical decoding data

From
Robert Haas
Date:
Add pg_recvlogical, a tool to receive data logical decoding data.

This is fairly basic at the moment, but it's at least useful for
testing and debugging, and possibly more.

Andres Freund

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8bdd12bbf093c846c9383c205e363d6ae35f11a6

Modified Files
--------------
src/bin/pg_basebackup/.gitignore       |    1 +
src/bin/pg_basebackup/Makefile         |   11 +-
src/bin/pg_basebackup/nls.mk           |    2 +-
src/bin/pg_basebackup/pg_recvlogical.c |  978 ++++++++++++++++++++++++++++++++
src/bin/pg_basebackup/receivelog.c     |  137 +----
src/bin/pg_basebackup/receivelog.h     |    2 +
src/bin/pg_basebackup/streamutil.c     |  119 +++-
src/bin/pg_basebackup/streamutil.h     |   10 +
8 files changed, 1135 insertions(+), 125 deletions(-)


Re: pgsql: Add pg_recvlogical, a tool to receive data logical decoding data

From
Heikki Linnakangas
Date:
On 03/18/2014 06:26 PM, Robert Haas wrote:
> Add pg_recvlogical, a tool to receive data logical decoding data.
>
> This is fairly basic at the moment, but it's at least useful for
> testing and debugging, and possibly more.
>
> Andres Freund
>
> Branch
> ------
> master
>
> Details
> -------
> http://git.postgresql.org/pg/commitdiff/8bdd12bbf093c846c9383c205e363d6ae35f11a6
>
> Modified Files
> --------------
> src/bin/pg_basebackup/.gitignore       |    1 +
> src/bin/pg_basebackup/Makefile         |   11 +-
> src/bin/pg_basebackup/nls.mk           |    2 +-
> src/bin/pg_basebackup/pg_recvlogical.c |  978 ++++++++++++++++++++++++++++++++
> src/bin/pg_basebackup/receivelog.c     |  137 +----
> src/bin/pg_basebackup/receivelog.h     |    2 +
> src/bin/pg_basebackup/streamutil.c     |  119 +++-
> src/bin/pg_basebackup/streamutil.h     |   10 +
> 8 files changed, 1135 insertions(+), 125 deletions(-)

I have a few questions about this:

1. Why is this in src/bin/pg_basebackup? As far as I can see, this has
nothing to do with taking base backups. I guess one could say the same
thing about pg_receivexlog, but that one is at least somewhat related to
a physical base backup, and shares code with pg_basebackup.

2. What is this good for? I would read the docs, but:

3. There are no docs.

It's a bit hard to be sure without understanding the purpose of this,
but I think this belongs in contrib, as an example of how to write a
logical decoding client. If it's only useful for "testing and debugging,
possibly more" as the commit message says, I don't think this should be
installed by default by "make install".

- Heikki


Re: pgsql: Add pg_recvlogical, a tool to receive data logical decoding data

From
Andres Freund
Date:
On 2014-03-18 18:51:29 +0200, Heikki Linnakangas wrote:
> I have a few questions about this:
>
> 1. Why is this in src/bin/pg_basebackup? As far as I can see, this has
> nothing to do with taking base backups. I guess one could say the same thing
> about pg_receivexlog, but that one is at least somewhat related to a
> physical base backup, and shares code with pg_basebackup.

The only reason is that it shares code, mostly reusing
streamutil.c. I've previously asked onlist and the general feedback was
that it's better to have it there, than to duplicate code.

> 2. What is this good for? I would read the docs, but:
> 3. There are no docs.

I think Robert's just working on the general docs patch.

I think in the form it's now in, it's actually usable for some real
world tasks, not just a demo. It's not an infrequent requirement to get
all DML to the database in a readable format for auditing purposes, and
this does provide it.

Greetings,

Andres Freund

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


Re: pgsql: Add pg_recvlogical, a tool to receive data logical decoding data

From
Andres Freund
Date:
Hi,

On 2014-03-18 16:26:19 +0000, Robert Haas wrote:
> Add pg_recvlogical, a tool to receive data logical decoding data.
>
> This is fairly basic at the moment, but it's at least useful for
> testing and debugging, and possibly more.

Inspecting the output by different compilers shows a screwup of mine,
added when introducing the fsyncing of the outputfile. There's a
unitialized variable usage when both --status-interval and
--fsync-interval are set to zero/disabled.

Greetings,

Andres Freund

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

Attachment