BUG #6710: txid_current() provides incorrect txid after server startup

From: tarvip(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6710: txid_current() provides incorrect txid after server startup
Date: 2012-06-27 07:08:21
Message-ID: E1SjmMP-0002E5-0N@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 6710
Logged by: Tarvi Pillessaar
Email address: tarvip(at)gmail(dot)com
PostgreSQL version: 9.1.4
Operating system: linux
Description:

This happens when epoch is greater than 0.
After a checkpoint it starts providing correct txid.

It seems that this regression is caused by following commit:
20d98ab6e4110087d1816cd105a40fcc8ce0a307 Correct epoch of txid_current()
when executed on a Hot Standby server.

When reverting this commit, txid_current() works as expected.

==
postgres(at)sbox ~ $ /usr/local/pgsql/bin/pg_resetxlog -n
/usr/local/pgsql/data
pg_control values:

First log file ID after reset: 0
First log file segment after reset: 3
pg_control version number: 903
Catalog version number: 201105231
Database system identifier: 5758410178624748543
Latest checkpoint's TimeLineID: 1
Latest checkpoint's NextXID: 10/733
Latest checkpoint's NextOID: 16385
Latest checkpoint's NextMultiXactId: 1
Latest checkpoint's NextMultiOffset: 0
Latest checkpoint's oldestXID: 710
Latest checkpoint's oldestXID's DB: 1
Latest checkpoint's oldestActiveXID: 0
Maximum data alignment: 8
Database block size: 8192
Blocks per segment of large relation: 131072
WAL block size: 8192
Bytes per WAL segment: 16777216
Maximum length of identifiers: 64
Maximum columns in an index: 32
Maximum size of a TOAST chunk: 1996
Date/time type storage: 64-bit integers
Float4 argument passing: by value
Float8 argument passing: by value
postgres(at)sbox ~ $ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
>/tmp/logfile 2>&1 &
[1] 2435
postgres(at)sbox ~ $ /usr/local/pgsql/bin/psql
psql (9.1.4)
Type "help" for help.

postgres=# select now(),txid_current();
now | txid_current
-------------------------------+--------------
2012-06-27 09:58:56.298494+03 | 733
(1 row)

postgres=# select now(),txid_current();
now | txid_current
-------------------------------+--------------
2012-06-27 10:01:15.960031+03 | 734
(1 row)

postgres=# checkpoint;
CHECKPOINT
postgres=# select now(),txid_current();
now | txid_current
-------------------------------+--------------
2012-06-27 10:01:21.180357+03 | 42949673695
(1 row)

postgres=#

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Craig Ringer 2012-06-27 08:48:05 Re: BUG #6705: 32 bit
Previous Message Magnus Hagander 2012-06-27 06:49:55 Re: BUG #6705: 32 bit