Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E90A2126090B for ; Wed, 27 Jun 2012 04:08:39 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SjmMd-0007NK-Fy for pgsql-bugs@postgresql.org; Wed, 27 Jun 2012 07:08:38 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SjmMP-00077k-PX for pgsql-bugs@postgresql.org; Wed, 27 Jun 2012 07:08:22 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1SjmMP-0002E5-0N for pgsql-bugs@postgresql.org; Wed, 27 Jun 2012 07:08:21 +0000 Date: Wed, 27 Jun 2012 07:08:21 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6710: txid_current() provides incorrect txid after server startup To: pgsql-bugs@postgresql.org From: tarvip@gmail.com X-Pg-Spam-Score: -1.0 (-) X-Archive-Number: 201206/227 X-Sequence-Number: 33454 The following bug has been logged on the website: Bug reference: 6710 Logged by: Tarvi Pillessaar Email address: tarvip@gmail.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. =3D=3D postgres@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@sbox ~ $ /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >/tmp/logfile 2>&1 & [1] 2435 postgres@sbox ~ $ /usr/local/pgsql/bin/psql psql (9.1.4) Type "help" for help. postgres=3D# select now(),txid_current(); now | txid_current = -------------------------------+-------------- 2012-06-27 09:58:56.298494+03 | 733 (1 row) postgres=3D# select now(),txid_current(); now | txid_current = -------------------------------+-------------- 2012-06-27 10:01:15.960031+03 | 734 (1 row) postgres=3D# checkpoint; CHECKPOINT postgres=3D# select now(),txid_current(); now | txid_current = -------------------------------+-------------- 2012-06-27 10:01:21.180357+03 | 42949673695 (1 row) postgres=3D# =