pgsql: Allow logical replication to transfer data in binary format.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow logical replication to transfer data in binary format.
Date: 2020-07-18 16:45:02
Message-ID: E1jwpxO-00062Q-TN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-07-18 18:58:31 pgsql: Fix replication/worker_internal.h to compile without other heade
Previous Message Michael Paquier 2020-07-18 13:45:57 pgsql: doc: Refresh more URLs in the docs