aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xact.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-04-30 21:01:53 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-04-30 21:01:53 +0000
commitc4320619635800a6116a02eee08b232c5abea266 (patch)
tree3db9b7562baf005c9ccf4976c293a4328dfa9509 /src/backend/access/transam/xact.c
parent641912b4d17fd214a5e5bae4e7bb9ddbc28b144b (diff)
downloadpostgresql-c4320619635800a6116a02eee08b232c5abea266.tar.gz
postgresql-c4320619635800a6116a02eee08b232c5abea266.zip
Change the timestamps recorded in transaction commit/abort xlog records
from time_t to TimestampTz representation. This provides full gettimeofday() resolution of the timestamps, which might be useful when attempting to do point-in-time recovery --- previously it was not possible to specify the stop point with sub-second resolution. But mostly this is to get rid of TimestampTz-to-time_t conversion overhead during commit. Per my proposal of a day or two back.
Diffstat (limited to 'src/backend/access/transam/xact.c')
-rw-r--r--src/backend/access/transam/xact.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e3f16d38a5b..f2685ee0b34 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.241 2007/04/30 03:23:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.242 2007/04/30 21:01:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -773,7 +773,7 @@ RecordTransactionCommit(void)
MyProc->inCommit = true;
SetCurrentTransactionStopTimestamp();
- xlrec.xtime = timestamptz_to_time_t(xactStopTimestamp);
+ xlrec.xact_time = xactStopTimestamp;
xlrec.nrels = nrels;
xlrec.nsubxacts = nchildren;
rdata[0].data = (char *) (&xlrec);
@@ -1069,7 +1069,7 @@ RecordTransactionAbort(void)
XLogRecPtr recptr;
SetCurrentTransactionStopTimestamp();
- xlrec.xtime = timestamptz_to_time_t(xactStopTimestamp);
+ xlrec.xact_time = xactStopTimestamp;
xlrec.nrels = nrels;
xlrec.nsubxacts = nchildren;
rdata[0].data = (char *) (&xlrec);
@@ -1247,7 +1247,7 @@ RecordSubTransactionAbort(void)
xl_xact_abort xlrec;
XLogRecPtr recptr;
- xlrec.xtime = time(NULL);
+ xlrec.xact_time = GetCurrentTimestamp();
xlrec.nrels = nrels;
xlrec.nsubxacts = nchildren;
rdata[0].data = (char *) (&xlrec);
@@ -4282,12 +4282,9 @@ xact_redo(XLogRecPtr lsn, XLogRecord *record)
static void
xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
{
- struct tm *tm = localtime(&xlrec->xtime);
int i;
- appendStringInfo(buf, "%04u-%02u-%02u %02u:%02u:%02u",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ appendStringInfoString(buf, timestamptz_to_str(xlrec->xact_time));
if (xlrec->nrels > 0)
{
appendStringInfo(buf, "; rels:");
@@ -4313,12 +4310,9 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
static void
xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
{
- struct tm *tm = localtime(&xlrec->xtime);
int i;
- appendStringInfo(buf, "%04u-%02u-%02u %02u:%02u:%02u",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ appendStringInfoString(buf, timestamptz_to_str(xlrec->xact_time));
if (xlrec->nrels > 0)
{
appendStringInfo(buf, "; rels:");