backport fix for mysql bug#12161 (XA and binlog)

Description

5.7 finally fixes the 10-yr-old bug#12161 — a.k.a. prepared XA transactions are lost on disconnect. They solved it by introducing a new XA_prepare_log_event. As we'll need to be able to read this event, we can as well merge the whole fix for this bug.

Environment

None

Status

Assignee

Unassigned

Reporter

Sergei Golubchik

Labels

External issue ID

None

External issue ID

None

Time tracking

80h

Fix versions

Priority

Major