|From:||Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>|
|To:||Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||2PC support for pglogical|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
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 rebased it 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 in corresponding records, otherwise we can lose correspondence between xid and gid if we are replaying data from wal sender while transaction was commited some time ago. So i’ve changed postgres to write gid’s not only on prepare, but also on commit/rollback prepared. That should be done only in logical level, but now I just want to here some other opinions on that.
* Abort prepared xlog record also lack database information. Normally logical decoding just cleans reorder buffer when facing abort, 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 with some fields renamed. Probably that is just due to historical reasons. It is possible to change PREPARE to write ordinary commit records with some flag and then use the same infrastructure to parse it. So DecodePrepare/DecodeCommit can be done with the same function.
|Next Message||Stephen Frost||2016-03-10 14:50:54||Re: Floating point timestamps|
|Previous Message||Robert Haas||2016-03-10 14:44:56||Re: Add generate_series(date,date) and generate_series(date,date,integer)|