tracking commit timestamps

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: tracking commit timestamps
Date: 2013-10-22 22:16:00
Message-ID: 20131022221600.GE4987@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

Hi,

There has been some interest in keeping track of timestamp of
transaction commits. This patch implements that.

There are some seemingly curious choices here. First, this module can
be disabled, and in fact it's turned off by default. At startup, we
verify whether it's enabled, and create the necessary SLRU segments if
so. And if the server is started with this disabled, we set the oldest
value we know about to avoid trying to read the commit TS of
transactions of which we didn't keep record. The ability to turn this
off is there to avoid imposing the overhead on systems that don't need
this feature.

Another thing of note is that we allow for some extra data alongside the
timestamp proper. This might be useful for a replication system that
wants to keep track of the origin node ID of a committed transaction,
for example. Exactly what will we do with the bit space we have is
unclear, so I have kept it generic and called it "commit extra data".

This offers the chance for outside modules to set the commit TS of a
transaction; there is support for WAL-logging such values. But the core
user of the feature (RecordTransactionCommit) doesn't use it, because
xact.c's WAL logging itself is enough. For systems that are replicating
transactions from remote nodes, it is useful.

We also keep track of the latest committed transaction. This is
supposed to be useful to calculate replication lag.

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

Attachment Content-Type Size
committs.patch text/x-diff 48.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-10-22 23:28:22 matviews do not lock relations during refresh
Previous Message Michael Banck 2013-10-22 21:59:48 Re: Commitfest II CLosed

Browse pgsql-www by date

  From Date Subject
Next Message Joshua D. Drake 2013-10-23 16:41:13 freecode.com
Previous Message Noah Misch 2013-10-21 01:10:13 Re: signed vs. unsigned in TYPEALIGN (was Re: space reserved for WAL record does not match what was written: panic on windows)