git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: c6e96a2) | patch
Introduce replication progress tracking infrastructure.
2015年4月29日 17:30:53 +0000 (19:30 +0200)
2015年4月29日 17:30:53 +0000 (19:30 +0200)
commit 5aa2350426c4fdb3d04568b65aadac397012bbcb
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
52 files changed:
contrib/test_decoding/Makefile diff | blob | blame | history
contrib/test_decoding/expected/replorigin.out [new file with mode: 0644] blob
contrib/test_decoding/sql/replorigin.sql [new file with mode: 0644] blob
contrib/test_decoding/test_decoding.c diff | blob | blame | history
doc/src/sgml/catalogs.sgml diff | blob | blame | history
doc/src/sgml/filelist.sgml diff | blob | blame | history
doc/src/sgml/func.sgml diff | blob | blame | history
doc/src/sgml/logicaldecoding.sgml diff | blob | blame | history
doc/src/sgml/postgres.sgml diff | blob | blame | history
doc/src/sgml/replication-origins.sgml [new file with mode: 0644] blob
src/backend/access/heap/heapam.c diff | blob | blame | history
src/backend/access/rmgrdesc/Makefile diff | blob | blame | history
src/backend/access/rmgrdesc/replorigindesc.c [new file with mode: 0644] blob
src/backend/access/rmgrdesc/xactdesc.c diff | blob | blame | history
src/backend/access/transam/commit_ts.c diff | blob | blame | history
src/backend/access/transam/rmgr.c diff | blob | blame | history
src/backend/access/transam/xact.c diff | blob | blame | history
src/backend/access/transam/xlog.c diff | blob | blame | history
src/backend/access/transam/xloginsert.c diff | blob | blame | history
src/backend/access/transam/xlogreader.c diff | blob | blame | history
src/backend/catalog/Makefile diff | blob | blame | history
src/backend/catalog/catalog.c diff | blob | blame | history
src/backend/catalog/system_views.sql diff | blob | blame | history
src/backend/replication/logical/Makefile diff | blob | blame | history
src/backend/replication/logical/decode.c diff | blob | blame | history
src/backend/replication/logical/logical.c diff | blob | blame | history
src/backend/replication/logical/origin.c [new file with mode: 0644] blob
src/backend/replication/logical/reorderbuffer.c diff | blob | blame | history
src/backend/storage/ipc/ipci.c diff | blob | blame | history
src/backend/utils/cache/syscache.c diff | blob | blame | history
src/bin/pg_resetxlog/pg_resetxlog.c diff | blob | blame | history
src/include/access/commit_ts.h diff | blob | blame | history
src/include/access/rmgrlist.h diff | blob | blame | history
src/include/access/xact.h diff | blob | blame | history
src/include/access/xlog.h diff | blob | blame | history
src/include/access/xlog_internal.h diff | blob | blame | history
src/include/access/xlogdefs.h diff | blob | blame | history
src/include/access/xloginsert.h diff | blob | blame | history
src/include/access/xlogreader.h diff | blob | blame | history
src/include/access/xlogrecord.h diff | blob | blame | history
src/include/catalog/catversion.h diff | blob | blame | history
src/include/catalog/indexing.h diff | blob | blame | history
src/include/catalog/pg_proc.h diff | blob | blame | history
src/include/catalog/pg_replication_origin.h [new file with mode: 0644] blob
src/include/replication/logical.h diff | blob | blame | history
src/include/replication/origin.h [new file with mode: 0644] blob
src/include/replication/output_plugin.h diff | blob | blame | history
src/include/replication/reorderbuffer.h diff | blob | blame | history
src/include/storage/lwlock.h diff | blob | blame | history
src/include/utils/syscache.h diff | blob | blame | history
src/test/regress/expected/rules.out diff | blob | blame | history
src/test/regress/expected/sanity_check.out diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /