From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Valery Kuzmin <valerij(dot)kuzmin(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: One transaction and several processes |
Date: | 2018-07-18 15:41:26 |
Message-ID: | CAKFQuwY+q05xV2zCto3QJXHNZZfnQ0D0swV9m6GApA9q-cA0RQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jul 18, 2018 at 8:31 AM, Valery Kuzmin <valerij(dot)kuzmin(at)gmail(dot)com>
wrote:
> Hi,
>
> Can multiple processes participate in a single transaction's execution?
> I need to do the following actions sequence:
> 1. Calling service begins transaction. At this step transaction
> manager generate new XID.
> 2. Calling service updates some data.
> 3. Need to detach a transaction from a service context before other
> service is called.
> 4. Called service resume transaction using XID.
> 5. Called service updates its data.
> 6. Calling service gets control, resume transaction using XID and does
> commit.
> How can the third and fourth step be implemented?
>
Your original pgsql-general post was the right place for this but I see it
got no response...
Basically no, if you need multiple service processes to share a session you
would need to share the persistent database connection between them at a
higher level (i.e., outside the database). IOW, the physical connection
needs to be shared, not an XID.
Depending on the specifics of this orchestration two-phase commit might
provide some useful capabilities but its considerably harder to setup
reliably.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Bossart, Nathan | 2018-07-18 16:58:48 | Re: Add SKIP LOCKED to VACUUM and ANALYZE |
Previous Message | Tomas Vondra | 2018-07-18 15:40:19 | Re: One transaction and several processes |