> On 20 Aug 2016, at 15:59, Craig Ringer <[email protected]> wrote:
>
> I'll wait for a test case or some more detail.
Thanks for clarification about how restart_lsn is working.
Digging slightly deeper into this topic revealed that problem was in two phase
decoding, not it logical decoding itself.
While I was writing DecodePrepare() I've and copied call to
SnapBuildCommitTxn() function from DecodeCommit()
which was removing current transaction from running list and that’s obviously
wrong thing to do for a prepared tx.
So I end up with following workaround:
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -950,7 +950,7 @@ SnapBuildAbortTxn(SnapBuild *builder, XLogRecPtr lsn,
*/
void
SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn, TransactionId xid,
- int nsubxacts, TransactionId *subxacts)
+ int nsubxacts, TransactionId *subxacts, bool
isCommit)
{
int nxact;
@@ -1026,7 +1026,8 @@ SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn,
TransactionId xid,
* Make sure toplevel txn is not tracked in running txn's anymore,
switch
* state to consistent if possible.
*/
- SnapBuildEndTxn(builder, lsn, xid);
+ if (isCommit)
+ SnapBuildEndTxn(builder, lsn, xid);
Calling SnapBuildCommitTxn with isCommit=true from commit and false from
Prepare. However while I’m not
observing partially decoded transactions anymore, I’m not sure that this is
right way to build proper snapshot and
something else isn’t broken.
Also while I was playing psycopg2 logical decoding client I do see empty
transaction containing only
BEGIN/COMMIT (with test_decoding output plugin, and current postgres master).
--
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers