My apologies for
In fact, my proposal will speed things up, because only one 2-phase commit between binlog and engine is needed per transaction. While in current implementation two are needed, one for XA PREPARE and one for XA COMMIT.
And a simple sequence like this will be able to group commit together (on the slave):
XA PREPARE 't1'; XA COMMIT 't1'; XA PREPARE 't2'; XA COMMIT 't2'; XA PREPARE 't3'; XA COMMIT 't3';
I believe in the current code, it's impossible to group-commit the XA PREPARE together with the XA COMMIT on a slave?
Of course they can be in one group. That's the part II ready for review in bb-10.6-MDEV-31949.
this hastily statement. In fact XA PREPARE (XAP) xid can't be in one binlog group with XA COMMIT (XAC) xid. Yet they can run in parallel up to the wait-for-prior commit by XAC. In normal cases XAC_k+i would be waiting for XAP_k 's completion which includes (per your idea) xid release (partly also addressed by the part I of the branch). This extra communication can be optimized away. For instance at the price of more sophisticated recovery (further details are deferred).