Hi, Kristofer!
On Oct 12, Kristofer Pettersson wrote:
> 3119 Kristofer Pettersson 2009-10-12
> Bug#46944 Internal prepared XA transction XIDs are not
> removed if server_id changes
>
> When MySQL crashes (or a snapshot is taken which simulates
> a crash), then it is possible that internal XA
> transactions (used to sync the binary log and InnoDB)
> can be left in a PREPARED state, whereas they should be
> rolled back. This is done when the server_id changes
> before the restart occurs.
>
> This patch releases he restriction that the server_id
> should be consistent if the XID is to be considerred
> valid. The rollback phase should then be able to
> clean up all pending XA transactions.
The patch is of course ok, as we discussed.
Although I'd prefer that you mention in the changeset comment *why*
server_id may change after a crash. The important use case is taking a
data snapshot on a slave to setup a new slave.
> === modified file 'sql/handler.h'
> --- a/sql/handler.h 2009-09-18 13:01:18 +0000
> +++ b/sql/handler.h 2009-10-12 12:46:00 +0000
> @@ -398,7 +398,6 @@ struct xid_t {
> my_xid get_my_xid()
> {
> return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0
> &&
> - !memcmp(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id))
> &&
> !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
> quick_get_my_xid() : 0;
> }
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring