From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow logical replication to transfer data in binary format.
Date: Sat, 18 Jul 2020 16:45:02 +0000
Message-ID: <E1jwpxO-00062Q-TN@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Allow logical replication to transfer data in binary format.
In-Reply-To: <E1jwpxO-00062Q-TN@gemulon.postgresql.org>
References: <E1jwpxO-00062Q-TN@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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