public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andy Fan <[email protected]>
To: Dave Cramer <[email protected]>
Cc: [email protected]
Subject: Re: Would preparing internally during XAResource.end(xid, TMSUCCESS) works?
Date: Wed, 7 Dec 2022 11:12:40 +0800
Message-ID: <CAKU4AWrS71pUTc1h7v3Rb45uvF7T2JCYHBOSgLLCgWBOyRsD4g@mail.gmail.com> (raw)
In-Reply-To: <CADK3HH+F6AxVp-Z0qtiK8sc1vC7ekuprria_kzTcUg0yBfGzrA@mail.gmail.com>
References: <CAKU4AWqF=FgsnyjSorBKLeCi50iB7NmT4KaQWKmp-gCgKmd_uQ@mail.gmail.com>
	<CADK3HH+F6AxVp-Z0qtiK8sc1vC7ekuprria_kzTcUg0yBfGzrA@mail.gmail.com>

Hi Dave:

Thanks for your feedback and sorry for the late reply.

Hi Andy,
>
> Sorry I'm not much help here.
>
> Were you able to figure this out?
>
>
I've been working on this for a while.  It would not work per
current  PG server code.  The biggest issue is when user
calls 'xa_end',   he/she isn't intent to persist the 2pc
transaction, but the PG code would do that during the 'prepare
transaction' statement.  In this case WE SHOULD NOT recover
it again during crash recovery.   I'm hacking the pg server code
not do it until a user called 'xa_prepare'.

The internal way to do this is: during xa_end,  I run the 'prepare
transaction xxx' statement and record a new xlog to rollback it
2pc, this is done at the end of the crash recovery stage.   and
If the user runs the 'xa_prepare',  I would add another xlog to
let the above thing not happen at the end of the crash recovery
stage.

(I hacked both JDBC driver and server code for the above stuff)

Besides this, I also find another issue that

connection 1:
xa_start('foo', ..);
insert into t select 1;
xa_end('foo', ..);

connection 2:
xa_start('foo', ..);
select * from t;  ==>  The above insert from connection 1 is visible for
current connection, but in our JDBC it doesn't.

I am also hacking this case as well, just record the transaction xid
which the 'foo' belongs to and add a new rule to the MVCC to let
the tuple be visible as well.

still tuned and testing now.

-- 
Best Regards
Andy Fan


view thread (3+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Would preparing internally during XAResource.end(xid, TMSUCCESS) works?
  In-Reply-To: <CAKU4AWrS71pUTc1h7v3Rb45uvF7T2JCYHBOSgLLCgWBOyRsD4g@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox