pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tarvip@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #7710: Xid epoch is not updated properly during checkpoint
Date: Tue, 27 Nov 2012 19:52:09 +0000
Message-ID: <E1TdRCT-00008s-Tc@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      7710
Logged by:          Tarvi Pillessaar
Email address:      tarvip@gmail.com
PostgreSQL version: 9.1.6
Operating system:   linux
Description:        

This happens only if wal_level=hot_standby.


Here are the steps to reproduce this issue.


We have following db cluster:

postgres@sbox /usr/local/pgsql $ pg_controldata data|grep NextXID
Latest checkpoint's NextXID:          0/4294966303
postgres@sbox /usr/local/pgsql $

Basically we have less than 1000 XIDs to epoch boundary.

Modify following parameters in conf:
checkpoint_segments = 16
checkpoint_completion_target = 0.9
checkpoint_timeout = 2min
log_checkpoints = on
log_line_prefix = '%t %r %p %d %u '
wal_level = hot_standby



Let's start up the cluster:
postgres@sbox /usr/local/pgsql $ postgres -D /usr/local/pgsql/data
2012-11-27 20:44:43 EET  26353   LOG:  database system was shut down at
2012-11-27 18:43:12 EET
2012-11-27 20:44:43 EET  26352   LOG:  database system is ready to accept
connections
...


In another session:
postgres@sbox /usr/local/pgsql $ psql -c "select now(),txid_current(),
txid_current()-2^32"
              now              | txid_current | ?column? 
-------------------------------+--------------+----------
 2012-11-27 20:45:01.394324+02 |   4294966303 |     -993



Now let's consume some XIDs, otherwise we have nothing to checkpoint.

postgres@sbox /usr/local/pgsql $ pgbench -c 1 -t 700
...
postgres@sbox /usr/local/pgsql $ psql -c "select now(),txid_current(),
txid_current()-2^32"
              now              | txid_current | ?column? 
-------------------------------+--------------+----------
 2012-11-27 20:45:27.256096+02 |   4294967005 |     -291



After a while, checkpoint starts:
2012-11-27 20:46:43 EET  26354   LOG:  checkpoint starting: time


Now let's cross the epoch boundary:

postgres@sbox /usr/local/pgsql $ pgbench -c 1 -t 700
...

postgres@sbox /usr/local/pgsql $ psql -c "select now(),txid_current(),
txid_current()-2^32"
              now              | txid_current | ?column? 
-------------------------------+--------------+----------
 2012-11-27 20:46:51.205384+02 |   4294967713 |      417

Seems that we have successfully crossed the boundary.


When checkpoint completes:
2012-11-27 20:47:32 EET  26354   LOG:  checkpoint complete: wrote 779
buffers (25.4%); 0 transaction log file(s) added, 0 removed, 9 recycled;
write=49.441 s, sync=0.170 s, total=49.636 s; sync files=16, longest=0.131
s, average=0.010 s

postgres@sbox /usr/local/pgsql $ psql -c "select now(),txid_current(),
txid_current()-2^32"
              now              | txid_current |  ?column?   
-------------------------------+--------------+-------------
 2012-11-27 20:47:42.031007+02 |          421 | -4294966875

It seems that epoch bump was rolled back.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (14+ messages)  latest in thread

Message-ID: <E1TdRCT-00008s-Tc@wrigleys.postgresql.org>
Permalink:  ../E1TdRCT-00008s-Tc@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1TdRCT-00008s-Tc@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tarvip@gmail.com
  Subject: Re: BUG #7710: Xid epoch is not updated properly during checkpoint
  In-Reply-To: <E1TdRCT-00008s-Tc@wrigleys.postgresql.org>
  References: <E1TdRCT-00008s-Tc@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox