Re: logical decoding and replication of sequences

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: logical decoding and replication of sequences
Дата
Msg-id 20211123010114.5jdp35p7p5cuzwsl@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: logical decoding and replication of sequences  (Hannu Krosing <hannuk@google.com>)
Ответы Re: logical decoding and replication of sequences  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Список pgsql-hackers
Hi,

On 2021-09-25 22:05:43 +0200, Hannu Krosing wrote:
> If our aim is just to make sure that all user-visible data in
> *transactional* tables is consistent with sequence state then  one
> very much simplified approach to this could be to track the results of
> nextval() calls in a transaction at COMMIT put the latest sequence
> value in WAL (or just track the sequences affected and put the latest
> sequence state in WAL at commit which needs extra read of sequence but
> protects against race conditions with parallel transactions which get
> rolled back later)

I think this is a bad idea. It's architecturally more complicated and prevents
use cases because sequence values aren't guaranteed to be as new as on the
original system. You'd need to track all sequence use somehow *even if there
is no relevant WAL generated* in a transaction. There's simply no evidence of
sequence use in a transaction if that transaction uses a previously logged
sequence value.

Greetings,

Andres Freund



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

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: Granting SET and ALTER SYSTE privileges for GUCs
Следующее
От: Peter Smith
Дата:
Сообщение: PG docs - CREATE PUBLICATION publish_via_partition_root