Re: [Proposal] global sequence implemented by snowflake ID

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [Proposal] global sequence implemented by snowflake ID
Дата
Msg-id ZWfi2wTda9kjJczk@paquier.xyz
обсуждение исходный текст
Ответ на Re: [Proposal] global sequence implemented by snowflake ID  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: [Proposal] global sequence implemented by snowflake ID  (Nikita Malakhov <hukutoc@gmail.com>)
Re: [Proposal] global sequence implemented by snowflake ID  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
On Tue, Nov 28, 2023 at 02:23:44PM +0530, Amit Kapila wrote:
> It is interesting to see you want to work towards globally distributed
> sequences. I think it would be important to discuss how and what we
> want to achieve with sequences w.r.t logical replication and or
> active-active configuration. There is a patch [1] for logical
> replication of sequences which will primarily achieve the failover
> case, i.e. if the publisher goes down and the subscriber takes over
> the role, one can re-direct connections to it. Now, if we have global
> sequences, one can imagine that even after failover the clients can
> still get unique values of sequences. It will be a bit more flexible
> to use global sequences, for example, we can use the sequence on both
> nodes at the same time which won't be possible with the replication of
> sequences as they will become inconsistent. Now, it is also possible
> that both serve different use cases and we need both functionalities
> but it would be better to have some discussion on the same.
>
> Thoughts?
>
> [1] - https://commitfest.postgresql.org/45/3823/

Thanks for pointing this out.  I've read through the patch proposed by
Tomas and both are independent things IMO.  The logical decoding patch
relies on the SEQ_LOG records to find out which last_value/is_called
to transfer, which is something directly depending on the in-core
sequence implementation.  Sequence AMs are concepts that cover much
more ground, leaving it up to the implementor to do what they want
while hiding the activity with a RELKIND_SEQUENCE (generated columns
included).

To put it short, I have the impression that one and the other don't
really conflict, but just cover different ground.  However, I agree
that depending on the sequence AM implementation used in a cluster
(snowflake IDs guarantee unicity with their machine ID), replication
may not be necessary because the sequence implementation may be able
to ensure that no replication is required from the start.
--
Michael

Вложения

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

Предыдущее
От: Peter Smith
Дата:
Сообщение: Re: pg_upgrade and logical replication
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: BackgroundPsql's set_query_timer_restart() may not work