Re: Logical decoding restart problems

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Logical decoding restart problems
Дата
Msg-id CAMsr+YGZ43AYKEJ9vT2HyUD4An=DSEq16LTngn1XyTLn0AjnLA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Logical decoding restart problems  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Список pgsql-hackers
On 20 August 2016 at 00:36, Konstantin Knizhnik <k.knizhnik@postgrespro.ru> wrote:
 

Sorry, I have not saved trace  with output of logical decoder. Bu t it really decodes just one update!

That's definitely a worry. Can you turn this into a reproducible, self contained test case?
 
DROP_REPLICATION_SLOT "mtm_slot_1";
CREATE_REPLICATION_SLOT "mtm_slot_1" LOGICAL "multimaster";
START_REPLICATION SLOT "mtm_slot_1" LOGICAL 0/0 ("startup_params_format" '1', "max_proto_version" '1', "min_proto_version" '1', "forward_changesets" '1', "mtm_replication_mode" 'recovered');

That'll make a new slot by looking for a recent/future non-overflowed xl_running_xacts record to set as restart_lsn. Every xact that starts _after_ that xl_running_xacts record will be decoded and replayed to the client in its entirety. Every xact started before that xl_running_xacts record, i.e. listed as running in the record, will not be replayed to the client at all, whether it commits or rolls back, even though the commit will be after the slot creation lsn.
 
I have also tried to calculate last origin LSN for this node and explicitly specify it in START_REPLICATION.

That will have no effect because of the logic you pointed out around confirmed_flush_lsn.
 
Dropping and re-creating the slot is the wrong thing to do if you want to maintain consistency. Just advance it over the changes you already saw from the other node. Read BDR's catchup mode code.

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

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Logical decoding restart problems
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Exporting more function in libpq