Introduce logical decoding.

Robert Haas <rhaas@postgresql.org>

Commit: b89e151054a05f0f6d356ca52e3b725dd0505e53
Author: Robert Haas <rhaas@postgresql.org>
Date: 2014-03-03T21:32:18Z
Releases: 9.4.0
Introduce logical decoding.

This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables.  The output format is controlled by a
so-called "output plugin"; an example is included.  To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.

Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.

Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.

Files

PathChange+/−
contrib/Makefile modified +1 −0
contrib/test_decoding/expected/binary.out added +35 −0
contrib/test_decoding/expected/concurrent_ddl_dml.out added +733 −0
contrib/test_decoding/expected/ddl.out added +651 −0
contrib/test_decoding/expected/decoding_in_xact.out added +89 −0
contrib/test_decoding/expected/delayed_startup.out added +38 −0
contrib/test_decoding/expected/mxact.out added +66 −0
contrib/test_decoding/expected/permissions.out added +130 −0
contrib/test_decoding/expected/rewrite.out added +107 −0
contrib/test_decoding/expected/toast.out added +90 −0
contrib/test_decoding/.gitignore added +4 −0
contrib/test_decoding/logical.conf added +2 −0
contrib/test_decoding/Makefile added +69 −0
contrib/test_decoding/specs/concurrent_ddl_dml.spec added +94 −0
contrib/test_decoding/specs/delayed_startup.spec added +24 −0
contrib/test_decoding/specs/mxact.spec added +38 −0
contrib/test_decoding/sql/binary.sql added +14 −0
contrib/test_decoding/sql/ddl.sql added +337 −0
contrib/test_decoding/sql/decoding_in_xact.sql added +41 −0
contrib/test_decoding/sql/permissions.sql added +69 −0
contrib/test_decoding/sql/rewrite.sql added +62 −0
contrib/test_decoding/sql/toast.sql added +51 −0
contrib/test_decoding/test_decoding.c added +404 −0
doc/src/sgml/contrib.sgml modified +1 −0
doc/src/sgml/filelist.sgml modified +1 −0
doc/src/sgml/test-decoding.sgml added +42 −0
src/backend/access/heap/heapam.c modified +16 −2
src/backend/access/heap/pruneheap.c modified +27 −10
src/backend/access/heap/rewriteheap.c modified +605 −1
src/backend/access/heap/tuptoaster.c modified +0 −26
src/backend/access/index/indexam.c modified +4 −2
src/backend/access/rmgrdesc/heapdesc.c modified +4 −0
src/backend/access/transam/xact.c modified +9 −1
src/backend/access/transam/xlog.c modified +34 −2
src/backend/catalog/index.c modified +1 −1
src/backend/catalog/system_views.sql modified +34 −0
src/backend/commands/analyze.c modified +2 −1
src/backend/commands/cluster.c modified +2 −2
src/backend/commands/dbcommands.c modified +15 −0
src/backend/commands/vacuum.c modified +4 −4
src/backend/commands/vacuumlazy.c modified +3 −2
src/backend/executor/nodeBitmapHeapscan.c modified +1 −2
src/backend/replication/logical/decode.c added +826 −0
src/backend/replication/logical/logical.c added +920 −0
src/backend/replication/logical/logicalfuncs.c added +509 −0
src/backend/replication/logical/Makefile added +19 −0
src/backend/replication/logical/reorderbuffer.c added +3059 −0
src/backend/replication/logical/snapbuild.c added +1885 −0
src/backend/replication/Makefile modified +2 −0
src/backend/replication/slot.c modified +226 −63
src/backend/replication/slotfuncs.c modified +89 −9
src/backend/replication/walreceiver.c modified +1 −1
src/backend/replication/walsender.c modified +8 −5
src/backend/storage/ipc/procarray.c modified +202 −20
src/backend/storage/ipc/standby.c modified +29 −1
src/backend/storage/lmgr/proc.c modified +4 −4
src/backend/tcop/postgres.c modified +11 −0
src/backend/utils/cache/inval.c modified +2 −2
src/backend/utils/cache/relcache.c modified +52 −5
src/backend/utils/time/snapmgr.c modified +97 −5
src/backend/utils/time/tqual.c modified +163 −1
src/bin/initdb/initdb.c modified +4 −1
src/include/access/heapam.h modified +1 −2
src/include/access/heapam_xlog.h modified +13 −1
src/include/access/rewriteheap.h modified +28 −1
src/include/access/transam.h modified +5 −0
src/include/access/tuptoaster.h modified +26 −1
src/include/access/xlog.h modified +1 −0
src/include/catalog/catversion.h modified +1 −1
src/include/catalog/pg_proc.h modified +11 −1
src/include/commands/vacuum.h modified +2 −2
src/include/replication/decode.h added +19 −0
src/include/replication/logicalfuncs.h added +24 −0
src/include/replication/logical.h added +100 −0
src/include/replication/output_plugin.h added +98 −0
src/include/replication/reorderbuffer.h added +351 −0
src/include/replication/slot.h modified +61 −3
src/include/replication/snapbuild.h added +83 −0
src/include/storage/itemptr.h modified +3 −0
src/include/storage/procarray.h modified +8 −2
src/include/storage/proc.h modified +4 −2
src/include/storage/sinval.h modified +2 −0
src/include/utils/inval.h modified +1 −0
src/include/utils/snapmgr.h modified +11 −0
src/include/utils/snapshot.h modified +30 −2
src/include/utils/tqual.h modified +14 −1
src/Makefile.global.in modified +2 −0
src/test/regress/expected/rules.out modified +3 −1
src/tools/pgindent/typedefs.list modified +33 −0