2PC support for pglogical

Поиск
Список
Период
Сортировка
От Stas Kelvich
Тема 2PC support for pglogical
Дата
Msg-id EE7452CA-3C39-4A0E-97EC-17A414972884@postgrespro.ru
обсуждение исходный текст
Ответы Re: 2PC support for pglogical  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
Hi.

Here is proof-of-concept version of two phase commit support for logical replication. There are some changes in core
postgres,pglogical_output and pglogical extensions. I’ve used version from 2nd Quadrant repo, pglogical branch and
rebasedit to current head. Some notes about this patch: 

* LWLockAssign() was deleted, so I changed that to new locks tranche api.

* Seems that only reliable way to get GID during replay of commit/rollback prepared is to force postgres to write GID
incorresponding records, otherwise we can lose correspondence between xid and gid  if we are replaying data from wal
senderwhile transaction was commited some time ago. So i’ve changed postgres to write gid’s not only on prepare, but
alsoon commit/rollback prepared. That should be done only in logical level, but now I just want to here some other
opinionson that. 

* Abort prepared xlog record also lack database information. Normally logical decoding just cleans reorder buffer when
facingabort, but in case of 2PC we should send it to callbacks anyway. So I’ve added that info to abort records. 

* Prepare emits xlog record with TwoPhaseFileHeader in it and that structure is the same as xl_xact_parsed_commit, but
withsome fields renamed. Probably that is just due to historical reasons. It is possible to change PREPARE to write
ordinarycommit records with some flag and then use the same infrastructure to parse it. So DecodePrepare/DecodeCommit
canbe done with the same function.  





---
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


Вложения

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Add generate_series(date,date) and generate_series(date,date,integer)
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Floating point timestamps