Re: Sequence's value can be rollback after a crashed recovery.

Поиск
Список
Период
Сортировка
От Andy Fan
Тема Re: Sequence's value can be rollback after a crashed recovery.
Дата
Msg-id CAKU4AWp39gxGw0=PErOpHNebPE+VWtgu4Uu18Jfz_KeJbfiH+A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Sequence's value can be rollback after a crashed recovery.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

You could say that that's the same rookie error as relying on the
persistence of any other uncommitted DML ... 

IIUC, This is not the same as uncommitted DML exactly.   For any uncommitted 
DML, it is a rollback for sure.  But as for sequence, The xmax is not changed
during sequence's value update by design and we didn't maintain the multi versions
for sequence,  so sequence can't be rolled back clearly.  The fact is a dirty data page flush 
can persist the change no matter the txn is committed or aborted.  The below example
can show the difference: 

SELECT nextval('s'); -- 1
begin;
SELECT nextval('s');  \watch 0.1 for a while, many checkpointer or data flush happened. 
-- crashed. 

If we run nextval('s') from the recovered system, we probably will _not_ get
the 2 (assume cachesize=1) like uncommitted DML.


--
Best Regards
Andy Fan 

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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Failed transaction statistics to measure the logical replication progress
Следующее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: XMAX_LOCK_ONLY and XMAX_COMMITTED (fk/multixact code)