postgresql/src/backend/access/rmgrdesc
Andres Freund 5aa2350426 Introduce replication progress tracking infrastructure.
When implementing a replication solution ontop of logical decoding, two
related problems exist:
* How to safely keep track of replication progress
* How to change replication behavior, based on the origin of a row;
  e.g. to avoid loops in bi-directional replication setups

The solution to these problems, as implemented here, consist out of
three parts:

1) 'replication origins', which identify nodes in a replication setup.
2) 'replication progress tracking', which remembers, for each
   replication origin, how far replay has progressed in a efficient and
   crash safe manner.
3) The ability to filter out changes performed on the behest of a
   replication origin during logical decoding; this allows complex
   replication topologies. E.g. by filtering all replayed changes out.

Most of this could also be implemented in "userspace", e.g. by inserting
additional rows contain origin information, but that ends up being much
less efficient and more complicated.  We don't want to require various
replication solutions to reimplement logic for this independently. The
infrastructure is intended to be generic enough to be reusable.

This infrastructure also replaces the 'nodeid' infrastructure of commit
timestamps. It is intended to provide all the former capabilities,
except that there's only 2^16 different origins; but now they integrate
with logical decoding. Additionally more functionality is accessible via
SQL.  Since the commit timestamp infrastructure has also been introduced
in 9.5 (commit 73c986add) changing the API is not a problem.

For now the number of origins for which the replication progress can be
tracked simultaneously is determined by the max_replication_slots
GUC. That GUC is not a perfect match to configure this, but there
doesn't seem to be sufficient reason to introduce a separate new one.

Bumps both catversion and wal page magic.

Author: Andres Freund, with contributions from Petr Jelinek and Craig Ringer
Reviewed-By: Heikki Linnakangas, Petr Jelinek, Robert Haas, Steve Singer
Discussion: 20150216002155.GI15326@awork2.anarazel.de,
    20140923182422.GA15776@alap3.anarazel.de,
    20131114172632.GE7522@alap2.anarazel.de
2015-04-29 19:30:53 +02:00
..
Makefile Introduce replication progress tracking infrastructure. 2015-04-29 19:30:53 +02:00
brindesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
clogdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
committsdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
dbasedesc.c Move WAL-related definitions from dbcommands.h to separate header file. 2015-03-09 15:50:49 +02:00
gindesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
gistdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
hashdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
heapdesc.c Tweak heapam's rmgr desc output slightly 2015-01-12 16:09:16 -03:00
mxactdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
nbtdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
relmapdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
replorigindesc.c Introduce replication progress tracking infrastructure. 2015-04-29 19:30:53 +02:00
seqdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
smgrdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
spgdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
standbydesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
tblspcdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
xactdesc.c Introduce replication progress tracking infrastructure. 2015-04-29 19:30:53 +02:00
xlogdesc.c Update copyright for 2015 2015-01-06 11:43:47 -05:00