Add undo log manager.
authorThomas Munro <thomas.munro@gmail.com>
Wed, 6 Mar 2019 03:46:04 +0000 (16:46 +1300)
committerThomas Munro <thomas.munro@gmail.com>
Wed, 17 Jul 2019 03:28:27 +0000 (15:28 +1200)
commit3da534dc6c28b2b3127d7400ab524f12b9faa0ae
treeaf1fcf06a9211d04d0cdd902d455e5c73de5caa2
parente3f1fb93eb7a8c5fad276c7dd6d82087135ae015
Add undo log manager.

Add a new subsystem to manage undo logs.  Undo logs allow data to be appended
efficiently, like logs.  They also allow data to be discarded efficiently from
the other end, like a queue.  Thirdly, they allow efficient buffered random
access, like a relation.

Undo logs physically consist of a set of 1MB segment files under
$PGDATA/base/undo (or per-tablespace equivalent) that are created, deleted or
renamed as required, similarly to the way that WAL segments are managed.
Meta-data about the set of undo logs is stored in shared memory, and written
to per-checkpoint files under $PGDATA/pg_undo.

Provide access to the undo files managed by undolog.c through bufmgr.c.
A new SMGR implementation allows bufmgr.c to access files created by
undolog.c.

Author: Thomas Munro, with contributions from Dilip Kumar, Rafia Sabih,
        Robert Haas and Amit Kapila
Reviewed-by:
Discussion: https://postgr.es/m/CAEepm%3D2EqROYJ_xYz4v5kfr4b0qw_Lq_6Pe8RTEC8rx3upWsSQ%40mail.gmail.com
53 files changed:
src/backend/access/Makefile
src/backend/access/rmgrdesc/Makefile
src/backend/access/rmgrdesc/undologdesc.c [new file with mode: 0644]
src/backend/access/transam/rmgr.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/access/undo/Makefile [new file with mode: 0644]
src/backend/access/undo/undolog.c [new file with mode: 0644]
src/backend/bootstrap/bootstrap.c
src/backend/catalog/system_views.sql
src/backend/commands/tablespace.c
src/backend/postmaster/pgstat.c
src/backend/replication/basebackup.c
src/backend/replication/logical/decode.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/localbuf.c
src/backend/storage/file/fd.c
src/backend/storage/ipc/ipci.c
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/lwlocknames.txt
src/backend/storage/smgr/Makefile
src/backend/storage/smgr/smgr.c
src/backend/storage/smgr/undofile.c [new file with mode: 0644]
src/backend/storage/sync/sync.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/guc.c
src/bin/initdb/initdb.c
src/bin/pg_checksums/pg_checksums.c
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_upgrade/Makefile
src/bin/pg_upgrade/check.c
src/bin/pg_upgrade/controldata.c
src/bin/pg_upgrade/exec.c
src/bin/pg_upgrade/pg_upgrade.c
src/bin/pg_upgrade/pg_upgrade.h
src/bin/pg_upgrade/undo.c [new file with mode: 0644]
src/bin/pg_waldump/rmgrdesc.c
src/include/access/rmgrlist.h
src/include/access/session.h
src/include/access/undolog.h [new file with mode: 0644]
src/include/access/undolog_xlog.h [new file with mode: 0644]
src/include/access/xlogutils.h
src/include/catalog/database_internal.h [new file with mode: 0644]
src/include/catalog/pg_proc.dat
src/include/pgstat.h
src/include/storage/bufmgr.h
src/include/storage/fd.h
src/include/storage/lwlock.h
src/include/storage/smgr.h
src/include/storage/sync.h
src/include/storage/undofile.h [new file with mode: 0644]
src/include/utils/guc.h
src/test/regress/expected/rules.out