tracking commit timestamps - Mailing list pgsql-hackers

From Alvaro Herrera
Subject tracking commit timestamps
Date
Msg-id 20131022221600.GE4987@eldon.alvh.no-ip.org
Whole thread Raw
Responses Re: tracking commit timestamps  (Amit Kapila <amit.kapila16@gmail.com>)
Re: tracking commit timestamps  (Jaime Casanova <jaime@2ndquadrant.com>)
Re: tracking commit timestamps  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Reasons not to like asprintf
Next
From: Andres Freund
Date:
Subject: matviews do not lock relations during refresh