We should document that GTID gaps may be possible if gtid_next is set to a specific value and a transaction fails.
This will cause undefined behavior for Galera Cluster.
One workaround may be to re-assign the same gtid_next value until a transaction succeeds:
# Record some GTID
SET @@SESSION.GTID_NEXT= 'a9264492-7be5-11ef-b353-ca382343a2f9:1';
CREATE TABLE t1 (i INT PRIMARY KEY, j INT) ENGINE=InnoDB;
# Now miss a GTID value by failing a transaction
SET @@SESSION.GTID_NEXT= 'a9264492-7be5-11ef-b353-ca382343a2f9:2';
--error 0, 1824
CREATE TABLE t_fail (i INT PRIMARY KEY, j INT, FOREIGN KEY(j) REFERENCES NON_EXISTING(i)) ENGINE=InnoDB;
# Write successful transaction with the same GTID
SET @@SESSION.GTID_NEXT= 'a9264492-7be5-11ef-b353-ca382343a2f9:2';
DROP TABLE t1;
See https://github.com/codership/mysql-wsrep-bugs/issues/1882.
We should document that GTID gaps may be possible if
gtid_next
is set to a specific value and a transaction fails. This will cause undefined behavior for Galera Cluster.One workaround may be to re-assign the same
gtid_next
value until a transaction succeeds: