pgsql: Allow logical replication to transfer data in binary format. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Allow logical replication to transfer data in binary format.
Date
Msg-id E1jwpxO-00062Q-TN@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Allow logical replication to transfer data in binary format.

This patch adds a "binary" option to CREATE/ALTER SUBSCRIPTION.
When that's set, the publisher will send data using the data type's
typsend function if any, rather than typoutput.  This is generally
faster, if slightly less robust.

As committed, we won't try to transfer user-defined array or composite
types in binary, for fear that type OIDs won't match at the subscriber.
This might be changed later, but it seems like fit material for a
follow-on patch.

Dave Cramer, reviewed by Daniel Gustafsson, Petr Jelinek, and others;
adjusted some by me

Discussion: https://postgr.es/m/CADK3HH+R3xMn=8t3Ct+uD+qJ1KD=Hbif5NFMJ+d5DkoCzp6Vgw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9de77b5453130242654ff0b30a551c9c862ed661

Modified Files
--------------
doc/src/sgml/catalogs.sgml                         |  26 ++-
doc/src/sgml/ref/alter_subscription.sgml           |   6 +-
doc/src/sgml/ref/create_subscription.sgml          |  26 ++-
src/backend/catalog/pg_subscription.c              |   1 +
src/backend/catalog/system_views.sql               |   2 +-
src/backend/commands/subscriptioncmds.c            | 102 ++++++++--
.../libpqwalreceiver/libpqwalreceiver.c            |   4 +
src/backend/replication/logical/proto.c            | 131 ++++++++----
src/backend/replication/logical/worker.c           | 225 ++++++++++++---------
src/backend/replication/pgoutput/pgoutput.c        |  28 ++-
src/bin/pg_dump/pg_dump.c                          |  33 ++-
src/bin/pg_dump/pg_dump.h                          |   1 +
src/bin/psql/describe.c                            |   8 +-
src/include/catalog/catversion.h                   |   2 +-
src/include/catalog/pg_subscription.h              |   5 +
src/include/replication/logicalproto.h             |  21 +-
src/include/replication/pgoutput.h                 |   4 +-
src/include/replication/walreceiver.h              |   1 +
src/test/regress/expected/subscription.out         |  47 +++--
src/test/regress/sql/subscription.sql              |  15 ++
src/test/subscription/t/014_binary.pl              | 134 ++++++++++++
21 files changed, 610 insertions(+), 212 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: doc: Refresh more URLs in the docs
Next
From: Tom Lane
Date:
Subject: pgsql: Fix replication/worker_internal.h to compile without other heade