Moving slot restart_lsn/catalog_xmin more eagerly from SQL functions

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Moving slot restart_lsn/catalog_xmin more eagerly from SQL functions
Дата
Msg-id 2d9a8e56-ba42-b0df-f6c8-3cd161aa0cf8@2ndquadrant.com
обсуждение исходный текст
Ответы Re: Moving slot restart_lsn/catalog_xmin more eagerly from SQLfunctions  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Список pgsql-hackers
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.

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

Вложения

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

Предыдущее
От: Chapman Flack
Дата:
Сообщение: Re: PostgreSQL vs SQL/XML Standards
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: Optimize constant MinMax expressions