Problems with sequences

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Problems with sequences
Дата
Msg-id 004701c17444$63f7b1e0$8201a8c0@inspiron
обсуждение исходный текст
Ответ на Re: Benchmarks  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Problems with sequences  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: v7.2b3 packages rebuilt ...
Следующее
От: Lamar Owen
Дата:
Сообщение: Re: v7.2b3 packaged, but not announced beyond here yet ...