]> granicus.if.org Git - postgresql/commit
Logical replication support for initial data copy
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 23 Mar 2017 12:36:36 +0000 (08:36 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 23 Mar 2017 12:55:37 +0000 (08:55 -0400)
commit7c4f52409a8c7d85ed169bbbc1f6092274d03920
treefa3dc592bb2855e5cc0a200f4c408b4c8d299be5
parent707576b571f05ec5b89adb65964d55f3ccccbd1b
Logical replication support for initial data copy

Add functionality for a new subscription to copy the initial data in the
tables and then sync with the ongoing apply process.

For the copying, add a new internal COPY option to have the COPY source
data provided by a callback function.  The initial data copy works on
the subscriber by receiving COPY data from the publisher and then
providing it locally into a COPY that writes to the destination table.

A WAL receiver can now execute full SQL commands.  This is used here to
obtain information about tables and publications.

Several new options were added to CREATE and ALTER SUBSCRIPTION to
control whether and when initial table syncing happens.

Change pg_dump option --no-create-subscription-slots to
--no-subscription-connect and use the new CREATE SUBSCRIPTION
... NOCONNECT option for that.

Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Tested-by: Erik Rijkers <er@xs4all.nl>
62 files changed:
contrib/file_fdw/file_fdw.c
doc/src/sgml/catalogs.sgml
doc/src/sgml/config.sgml
doc/src/sgml/logical-replication.sgml
doc/src/sgml/monitoring.sgml
doc/src/sgml/protocol.sgml
doc/src/sgml/ref/alter_subscription.sgml
doc/src/sgml/ref/create_subscription.sgml
doc/src/sgml/ref/pg_dump.sgml
src/backend/catalog/Makefile
src/backend/catalog/heap.c
src/backend/catalog/pg_publication.c
src/backend/catalog/pg_subscription.c
src/backend/catalog/system_views.sql
src/backend/commands/copy.c
src/backend/commands/subscriptioncmds.c
src/backend/parser/gram.y
src/backend/postmaster/pgstat.c
src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
src/backend/replication/logical/Makefile
src/backend/replication/logical/launcher.c
src/backend/replication/logical/relation.c
src/backend/replication/logical/snapbuild.c
src/backend/replication/logical/tablesync.c [new file with mode: 0644]
src/backend/replication/logical/worker.c
src/backend/replication/repl_gram.y
src/backend/replication/repl_scanner.l
src/backend/replication/walsender.c
src/backend/tcop/postgres.c
src/backend/utils/adt/misc.c
src/backend/utils/cache/syscache.c
src/backend/utils/misc/guc.c
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/t/002_pg_dump.pl
src/include/catalog/catversion.h
src/include/catalog/indexing.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_subscription_rel.h [new file with mode: 0644]
src/include/commands/copy.h
src/include/nodes/nodes.h
src/include/nodes/parsenodes.h
src/include/nodes/replnodes.h
src/include/parser/kwlist.h
src/include/pgstat.h
src/include/replication/logical.h
src/include/replication/logicallauncher.h
src/include/replication/snapbuild.h
src/include/replication/walreceiver.h
src/include/replication/walsender.h
src/include/replication/worker_internal.h
src/include/utils/syscache.h
src/test/regress/expected/object_address.out
src/test/regress/expected/rules.out
src/test/regress/expected/sanity_check.out
src/test/regress/expected/subscription.out
src/test/regress/sql/object_address.sql
src/test/regress/sql/subscription.sql
src/test/subscription/t/001_rep_changes.pl
src/test/subscription/t/002_types.pl
src/test/subscription/t/003_constraints.pl
src/test/subscription/t/004_sync.pl [new file with mode: 0644]