Re: eXtensible Transaction Manager API - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: eXtensible Transaction Manager API
Date
Msg-id CAB7nPqTrFw4ZbsgwdwVuVE9AiDtLxOdC+6ExD9U-V5jAp3h_sw@mail.gmail.com
Whole thread Raw
In response to Re: eXtensible Transaction Manager API  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
Responses Re: eXtensible Transaction Manager API  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
List pgsql-hackers
On Sun, Nov 8, 2015 at 1:53 AM, Konstantin Knizhnik wrote:
> In tsDTM approach two phase commit is performed by coordinator and currently
> is using standard PostgreSQL two phase commit:
>
> Code in GO performing two phase commit:
>
>           exec(conn1, "prepare transaction '" + gtid + "'")
>           exec(conn2, "prepare transaction '" + gtid + "'")
>           exec(conn1, "select dtm_begin_prepare($1)", gtid)
>           exec(conn2, "select dtm_begin_prepare($1)", gtid)
>           csn = _execQuery(conn1, "select dtm_prepare($1, 0)", gtid)
>           csn = _execQuery(conn2, "select dtm_prepare($1, $2)", gtid, csn)
>           exec(conn1, "select dtm_end_prepare($1, $2)", gtid, csn)
>           exec(conn2, "select dtm_end_prepare($1, $2)", gtid, csn)
>           exec(conn1, "commit prepared '" + gtid + "'")
>           exec(conn2, "commit prepared '" + gtid + "'")
>
> If commit at some of the nodes failed, coordinator should rollback prepared
> transaction at all nodes.

Not always. If COMMIT PREPARED fails at some of the nodes but succeeds
on others, the transaction is already partially acknowledged as
committed in the cluster. Hence it makes more sense for the
coordinator to commit transactions on the remaining nodes. Before
issuing any COMMIT PREPARED queries, I guess that's fine to rollback
the transactions on all nodes though.
-- 
Michael



pgsql-hackers by date:

Previous
From: Artur Zakirov
Date:
Subject: Re: [PROPOSAL] Improvements of Hunspell dictionaries support
Next
From: Michael Paquier
Date:
Subject: Re: OS X El Capitan and DYLD_LIBRARY_PATH