From: Michael P. <mic...@gm...> - 2010-12-06 05:32:25
|
> > I think we should try to minimize changes to CommitTransaction. Why not use > the PrepareTransaction() to prepare the transaction instead of duplicating > that code inside CommitTransaction ? Also, it would be nice if you can take > away new code in a separate function and call that, something like > AtEOXact_PGXC() or something like that. > Hi all, I changed deeply the algorithm to avoid code duplication for implicit 2PC. With the patch attached, Coordinator is prepared only if 2 Coordinators at least are involved in a transaction (DDL case). If only one Coordinator is involved in transaction or if transaction does not contain any DDL, transaction is prepared on the involved nodes only. To sum up: 1) for DDL transaction (more than 1 Coordinator and more than 1 Datanode involved in a transaction) - prepare on Coordinator (2PC file written) - prepare on Nodes (2PC file written) - Commit prepared on Coordinator - Commit prepared on Datanodes 2) If no Coordinator, or only one Coordinator is involved in a transaction - prepare on nodes - commit on Coordinator - Commit on Datanodes Note: I didn' t put calls to implicit prepare functions in a separate functions because modification of CommitTransaction() are really light. Regards, -- Michael Paquier http://michaelpq.users.sourceforge.net |