Re: Moving slot restart_lsn/catalog_xmin more eagerly from SQLfunctions

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: Moving slot restart_lsn/catalog_xmin more eagerly from SQLfunctions
Дата
Msg-id a1a8f768-e1f0-6915-88cd-2b0ec32d8bf8@2ndquadrant.com
обсуждение исходный текст
Ответ на Moving slot restart_lsn/catalog_xmin more eagerly from SQL functions  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Список pgsql-hackers
On 30/12/2018 20:27, Petr Jelinek wrote:
> Hi,
> 
> while messing around with slot code I noticed that the SQL functions for
> consuming/moving logical replication slots only move restart_lsn up to
> previously consumed position and not to currently consumed position. The
> reason for that is that restart_lsn is not moved forward unless new
> value is smaller that current confirmed_lsn of the slot. But we only
> update confirmed_lsn of the slot at the end of the SQL functions so we
> can only move restart_lsn up to the position we reached on previous
> call. Same is true for catalog_xmin.
> 
> This does not really hurt much functionality wise but it means that
> every record is needlessly processed twice as we always restart from
> position that was reached 2 calls of the function ago and that we keep
> older catalog_xmin than necessary which can potentially affect system
> catalog bloat.
> 
> This affects both the  pg_logical_slot_get_[binary_]changes and
> pg_replication_slot_advance.
> 
> Attached patch improves things by adding call to move the slot's
> restart_lsn and catalog_xmin to the last serialized snapshot position
> right after we update the confirmed_lsn.
> 

Meh, and it has copy-paste issue. Fixed in new attachment.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services

Вложения

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

Предыдущее
От: Vik Fearing
Дата:
Сообщение: Re: Optimize constant MinMax expressions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unified logging system for command-line programs