Re: Bug #613: Sequence values fall back to previously checkpointed

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ben Grimm <bgrimm@zaeon.com>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>, pgsql-bugs@postgresql.org, Vadim Mikheev <vmikheev@sectorbase.com>
Date: 2002-03-13T19:39:37Z
Lists: pgsql-bugs
Ben Grimm <bgrimm@zaeon.com> writes:
> It seems like you just need to ensure that when the sequence is loaded 
> from disk that log_cnt gets updated and written back to disk before the 
> sequence is used.  I'm not sure of the impact, but I can't reproduce the 
> bugs after making these changes.  I just added a flag to the SeqTableData 
> struct to say whether its been logged yet - this seems like overkill.. 
> but it works for me :-)  (at least in the scenarios I've tried)

I don't think that can work.  AFAICT what your patch does is to ensure
a WAL record is written by the first nextval() in any given backend
session.  But what we need is to ensure a WAL record from the first
nextval() after a checkpoint.  The failure cases for your patch would
involve backends that have been running for longer than one checkpoint
cycle ...

			regards, tom lane