pgsql: Keep track of transaction commit timestamps

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Keep track of transaction commit timestamps
Date: 2014-12-03 14:54:22
Message-ID: E1XwBJu-0000Oh-PA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Keep track of transaction commit timestamps

Transactions can now set their commit timestamp directly as they commit,
or an external transaction commit timestamp can be fed from an outside
system using the new function TransactionTreeSetCommitTsData(). This
data is crash-safe, and truncated at Xid freeze point, same as pg_clog.

This module is disabled by default because it causes a performance hit,
but can be enabled in postgresql.conf requiring only a server restart.

A new test in src/test/modules is included.

Catalog version bumped due to the new subdirectory within PGDATA and a
couple of new SQL functions.

Authors: Álvaro Herrera and Petr Jelínek

Reviewed to varying degrees by Michael Paquier, Andres Freund, Robert
Haas, Amit Kapila, Fujii Masao, Jaime Casanova, Simon Riggs, Steven
Singer, Peter Eisentraut

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/73c986adde5d73a5e2555da9b5c8facedb146dcd

Modified Files
--------------
contrib/pg_upgrade/pg_upgrade.c | 7 +
contrib/pg_xlogdump/rmgrdesc.c | 1 +
doc/src/sgml/config.sgml | 14 +
doc/src/sgml/func.sgml | 39 +
doc/src/sgml/ref/pg_resetxlog.sgml | 19 +-
doc/src/sgml/storage.sgml | 5 +
src/backend/access/rmgrdesc/Makefile | 2 +-
src/backend/access/rmgrdesc/committsdesc.c | 82 ++
src/backend/access/rmgrdesc/xlogdesc.c | 3 +
src/backend/access/transam/Makefile | 5 +-
src/backend/access/transam/README | 2 +-
src/backend/access/transam/commit_ts.c | 902 ++++++++++++++++++++
src/backend/access/transam/rmgr.c | 1 +
src/backend/access/transam/slru.c | 2 +-
src/backend/access/transam/varsup.c | 4 +-
src/backend/access/transam/xact.c | 27 +-
src/backend/access/transam/xlog.c | 43 +-
src/backend/commands/vacuum.c | 8 +-
src/backend/libpq/hba.c | 2 +-
src/backend/replication/logical/decode.c | 1 +
src/backend/storage/ipc/ipci.c | 3 +
src/backend/storage/lmgr/lwlock.c | 4 +
src/backend/utils/misc/guc.c | 10 +
src/backend/utils/misc/postgresql.conf.sample | 2 +
src/bin/initdb/initdb.c | 1 +
src/bin/pg_controldata/pg_controldata.c | 4 +
src/bin/pg_resetxlog/pg_resetxlog.c | 75 +-
src/include/access/commit_ts.h | 72 ++
src/include/access/rmgrlist.h | 1 +
src/include/access/transam.h | 6 +
src/include/access/xlog_internal.h | 1 +
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_control.h | 3 +
src/include/catalog/pg_proc.h | 6 +
src/include/storage/lwlock.h | 5 +-
src/include/utils/builtins.h | 4 +
src/test/modules/Makefile | 1 +
src/test/modules/commit_ts/.gitignore | 4 +
src/test/modules/commit_ts/Makefile | 15 +
src/test/modules/commit_ts/commit_ts.conf | 1 +
.../commit_ts/expected/commit_timestamp.out | 39 +
.../commit_ts/expected/commit_timestamp_1.out | 34 +
.../modules/commit_ts/sql/commit_timestamp.sql | 24 +
43 files changed, 1458 insertions(+), 28 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Stefan Kaltenbrunner 2014-12-03 18:34:32 Re: pgsql: Keep track of transaction commit timestamps
Previous Message Alvaro Herrera 2014-12-03 12:44:23 Re: [COMMITTERS] pgsql: Fix whitespace

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-12-03 14:54:38 Re: tracking commit timestamps
Previous Message José Luis Tallón 2014-12-03 14:50:00 Re: Sequence Access Method WIP