Re: [BUGS] Bug #613: Sequence values fall back to previously chec

Поиск
Список
Период
Сортировка
От Mikheev, Vadim
Тема Re: [BUGS] Bug #613: Sequence values fall back to previously chec
Дата
Msg-id 3705826352029646A3E91C53F7189E325184D4@sectorbase2.sectorbase.com
обсуждение исходный текст
Список pgsql-hackers
> AFAICS the only way that we could make the one-WAL-record-every-32-
> nextvals idea really work would be if CHECKPOINT could nullify the
> logged-in-advance state of each sequence (so that the first nextval
> after a checkpoint would always generate a fresh WAL record, but
> subsequent ones wouldn't have to).  But I don't see any practical
> way for CHECKPOINT to do that, especially not for sequences whose
> disk block isn't even in memory at the instant of the CHECKPOINT.

But sequences can force WAL record if sequence page LSN is <= than
system RedoRecPtr (XLogCtlInsert.RedoRecPtr), ie previously made
sequence WAL record is "too old" and would not be played during
restart. It seems safe to do NOT write WAL record if sequence
LSN > system RedoRecPtr because of checkpoint started after our
check would finish only after writing to disk sequence buffer with
proper last_value and log_cnt (nextval keeps lock on sequence buffer).

What is not good is that to read system RedoRecPtr backend has to
acquire XLogInsertLock but probably we can change system RedoRecPtr
read/write rules:

- to update RedoRecPtr one has to keep not only XLogInsertLock but also acquire XLogInfoLock (this is only CheckPointer
whoupdates RedoRecPtr);
 
- to read RedoRecPtr one has to keep either XLogInsertLock or XLogInfoLock.

This way nextval would only acquire XLogInfoLock to check
system RedoRecPtr.

?

Vadim


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

Предыдущее
От: "Zeugswetter Andreas SB SD"
Дата:
Сообщение: Re: Survey results on Oracle/M$NT4 to PG72/RH72 migration
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: Archives