apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
20.02k stars 6.77k forks source link

[Feature]Support to execute postgresql XA statement directly through proxy #24414

Open FlyingZC opened 1 year ago

FlyingZC commented 1 year ago

Feature Request

Hi community. We want to support to execute postgresql XA statement directly through proxy. If you are interested, welcome to complete it.

Is your feature request related to a problem?

No.

Describe the feature you would like.

Currently, Proxy supports users to directly execute MySQL XA statements, using Proxy as an RM, and multiple Proxies can be executed by opening XA transactions externally. Postgresql/openGauss needs a simple adaptation.

You can refer to TransactionXAHandler.

Postgresql xa syntax is as follows:

BEGIN;
-- execute your sql statements

-- xa prepare
PREPARE TRANSACTION 'test';

-- xa phase 2 (commit or rollback)
ROLLBACK PREPARED 'test';
COMMIT PREPARED 'test';

-- xa recovery
select * from pg_prepared_xacts;
chenlong1993 commented 1 year ago

I want try it

strongduanmu commented 1 year ago

@clbigdata Welcome, I just assign this issue to you.