Problems with sequences

From: "Dave Cramer" <dave(at)fastcrypt(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Problems with sequences
Date: 2001-11-23 17:29:21
Message-ID: 004701c17444$63f7b1e0$8201a8c0@inspiron
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I am running PostgreSQL 7.0.3 on a linux box.

My application uses java/persistence layer/jdbc which does the following
when inserting a row

1) gets a connection from the pool and gets a new id for the row using
select nextval('sequence');
2) returns the connection to the pool
3) gets another connection from the pool and inserts the data into the
row using the id retrieved in step 1
4) returns the connection to the pool

Recently we have had instances where the postmaster has 'crashed' and it
appears that the sequence numbers were not written to disk

After the postmaster restarts we have instances where there are rows in
the database with id's greater than the current sequence value. The
interesting part is that values are always different by 4?

In other words there is a row with an id 1004 and the sequence is
currently 1000?

We are running with fsync on. One thing that has changed lately is we
are running with quite a few buffers?

Any insight would be appreciated,

Dave

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 2001-11-23 17:56:09 Re: v7.2b3 packaged, but not announced beyond here yet ...
Previous Message Tom Lane 2001-11-23 17:29:19 Re: v7.2b3 packages rebuilt ...