Re: Replication sequence

Поиск
Список
Период
Сортировка
От Jehan-Guillaume de Rorthais
Тема Re: Replication sequence
Дата
Msg-id 20210216105145.03b5943b@firost
обсуждение исходный текст
Ответ на Replication sequence  (Paolo Saudin <paolosaudin@gmail.com>)
Ответы Re: Replication sequence  (Paolo Saudin <paolosaudin@gmail.com>)
Список pgsql-general
On Mon, 15 Feb 2021 18:55:14 +0100
Paolo Saudin <paolosaudin@gmail.com> wrote:

> Hi all,
> I have two servers, a primary and a secondary one with a streaming replica
> setup.
> Today I noticed that some sequences are not lined-up, the replica ones are
> well ahead, while the records number is the same. How is it possible?

This is because sequences are not WAL logged on every nextval() call, but by
batch of sequence cache+32 values. As standbys are fed with WAL stream from
primary, their sequences appears jump, then stall, then jump, etc.

See:

https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/commands/sequence.c?id=f672df5fdd22dac14c98d0a0bf5bbaa6ab17f8a5#n52


https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/commands/sequence.c?id=f672df5fdd22dac14c98d0a0bf5bbaa6ab17f8a5#n661

I'm not sure if this is documented somewhere... ?



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

Предыдущее
От: João Gaspar
Дата:
Сообщение: Re: [LDAPS] Test connection user with ldaps server
Следующее
От: Guy Burgess
Дата:
Сообщение: Re: PostgreSQL occasionally unable to rename WAL files (NTFS)