Обсуждение: pgsql: Keep track of transaction commit timestamps

Поиск
Список
Период
Сортировка

pgsql: Keep track of transaction commit timestamps

От
Alvaro Herrera
Дата:
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(-)


Re: pgsql: Keep track of transaction commit timestamps

От
Stefan Kaltenbrunner
Дата:
On 12/03/2014 03:54 PM, Alvaro Herrera wrote:
> 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

this broke the docs build:

http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2014-12-03%2016%3A17%3A01



Stefan


Re: pgsql: Keep track of transaction commit timestamps

От
Alvaro Herrera
Дата:
Stefan Kaltenbrunner wrote:
> On 12/03/2014 03:54 PM, Alvaro Herrera wrote:
> > Keep track of transaction commit timestamps

> this broke the docs build:
>
> http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=guaibasaurus&dt=2014-12-03%2016%3A17%3A01

Woops, thanks.  Fixed.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services