I have known for some times that there is an interesting improvement in MySQL 8.0.17 regarding GTID Crash Safety, but I have not had the time nor the need to look into it before. When writing my last post (Understanding MySQL Replication "fatal error 1236": [...]), I saw something interesting related to this, and it is now time to cover this on my blog. From my point of view, this change is
The latest from the MySQL community
Ideas, releases, practical guides, and perspectives from the people building with MySQL.
This is a follow-up for MySQL GTID tags and binlog events, but you don’t need to read that first.
One of the recent innovations in MySQL was the addition of Tagged
GTID’s. These tagged GTID’s take the format of
<uuid>:<tag>:<transaction_id>.
And this change means that the GTID_LOG_EVENT’s in
the binary logs needed to be changed. The MySQL team at Oracle
decided to not change the existing format, but introduce a new
event: GTID_TAGGED_LOG_EVENT.
Initially I assumed that decoding the new event would me mostly identical to the original event, but with just a single field added. But this isn’t the case as Oracle MySQL deciced to use a new serialization format (Yes, more innovation) and use it for this new event. The new serialization format is documented …
[Read more]MySQL 8.4 and newer have extended the Global Transaction ID (GTID) functionality with a new “tag” option.
Refresher on GTID
A GTID is a unique ID that is assigned to a transaction. This is
used if gtid_mode is set to ON. The
benefit of this is that a transaction can be uniquely identified
in a MySQL replication setup with multiple levels. Among others
this makes it easier to refactor a replication tree as a MySQL
replica knows which transactions it has seen and can use this to
find the right position to start replicating from a new source.
The format of GTIDs is documented here.
Before GTID was used replication worked based on a file and
offset
(e.g. file=binlog.000001,offset=4),
which is unique to every server.
A GTID without tag looks like …
[Read more]Replication has been the core functionality, allowing high availability in MySQL for decades already. However, you may still encounter replication errors that keep you awake at night. One of the most common and challenging to deal with starts with: “Got fatal error 1236 from source when reading data from binary log“. This blog post is […]
Part 1
What is a GTID? Oracle/MySQL define a GTID as "A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (the source). This identifier is unique not only to the server on which it originated, but is unique across all servers in a given replication topology."
An errant transaction can make promotion of a replica to primary very difficult.
An errant transaction is BAD. Why is it bad? The errant transaction could still be in the replicas binlog so when it becomes the new primary these event will get sent to other replicas causing data corruption or breaking replication.
Its easy to prevent errant transaction.
-
read_only = ONin the replicas my.cnf - Disable binlogs when you need to perform work on a replica.
set session sql_log_bin = 'off';before your work on replica. …
MySQL 8.0.23 introduces a new feature that makes replication possible from a source server that has been configured without Global Transaction Identifiers (GTIDs) to a replica server configured with GTIDs. This can be achieved by configuring replication channels to use the parameter ASSIGN_GTIDS_TO_ANONYMOUS_TRANSACTIONS with the CHANGE REPLICATION SOURCE command.…
Tweet Share
At my FOSDEM talk earlier this year, I gave a trick for fixing a crashed GTID replica. I never blogged about this, so now is a good time. What is pushing me to write on this today is my talk at MinervaDB Athena 2020 this Friday. At this conference, I will present more details about MySQL replication crash safety. So you know what to do if you want to learn more about
GTID-based replication makes managing replication topology easy: just CHANGE MASTER to any node and voilà. It doesn’t always work, but for the most part it does. That’s great, but it can hide a serious problem: missing writes. Even when MySQL GTID-based replication says, “OK, sure!”, which is most of the time, you should double check it.
GTID-based replication makes managing replication topology easy: just CHANGE MASTER to any node and voilà. It doesn’t always work, but for the most part it does. That’s great, but it can hide a serious problem: missing writes. Even when MySQL GTID-based replication says, “OK, sure!”, which is most of the time, you should double check it.
GTID-based replication makes managing replication topology easy: just CHANGE MASTER to any node and voilà. It doesn’t always work, but for the most part it does. That’s great, but it can hide a serious problem: missing writes. Even when MySQL GTID-based replication says, “OK, sure!”, which is most of the time, you should double check it.