All pages
Powered by GitBook
1 of 1

Loading...

Using MariaDB GTIDs with MariaDB Galera Cluster

MariaDB's are very useful when used with , which is primarily what that feature was developed for. Galera Cluster, on the other hand, was developed by Codership for all MySQL and MariaDB variants, and the initial development of the technology pre-dated MariaDB's implementation. As a side effect, MariaDB Galera Cluster (at least until ) only partially supports MariaDB's implementation.

GTID Support for Write Sets Replicated by Galera Cluster

Galera Cluster has its own certification-based replication method that is substantially different from . However, it would still be beneficial if MariaDB Galera Cluster was able to associate a Galera Cluster write set with a that is globally unique but that is also consistent for that write set on each cluster node.

Before , MariaDB Galera Cluster did not replicate the original with the write set except in cases where the transaction was originally applied by a . Each node independently generated its own for each write set in most cases. See MDEV-20720.

Wsrep GTID Mode

MariaDB supports wsrep_gtid_mode.

MariaDB has a feature called wsrep GTID mode. When this mode is enabled, MariaDB uses some tricks to try to associate each Galera Cluster write set with a that is globally unique, but that is also consistent for that write set on each cluster node. These tricks work in some cases, but can still become inconsistent among cluster nodes.

Enabling Wsrep GTID Mode

Several things need to be configured for wsrep GTID mode to work, such as

  • wsrep_gtid_mode=ON needs to be set on all nodes in the cluster.

  • wsrep_gtid_domain_id needs to be set to the same value on all nodes in a given cluster, so that each cluster node uses the same domain when assigning for Galera Cluster's write sets. When replicating between two clusters, each cluster should have this set to a different value, so that each cluster uses different domains when assigning for their write sets.

  • needs to be enabled on all nodes in the cluster. See MDEV-9855.

  • needs to be set to the same path on all nodes in the cluster. See MDEV-9856.

And as an extra safety measure:

  • should be set to a different value on all nodes in a given cluster, and each of these values should be different than the configured wsrep_gtid_domain_id value. This is to prevent a node from using the same domain used for Galera Cluster's write sets when assigning for non-Galera transactions, such as DDL executed with wsrep_sst_method=RSU set or DML executed with wsrep_on=OFF set.

If you want to avoid writes accidentialy local GTIDS, you can avoid it with wsrep_gtid_mode = DISALLOW_LOCAL_GTID

In this case you get an error: ERROR 4165 (HY000): Galera replication not supported

You can overwrite it temporarily with set = 0;

For information on setting , see Using MariaDB Replication with MariaDB Galera Cluster: Setting server_id on Cluster Nodes.

Known Problems with Wsrep GTID Mode

Until , there were known cases where could become inconsistent across the cluster nodes.

A known issue (fixed in ) is:

  • Implicitly dropped temporary tables can make GTIDs inconsistent. See MDEV-14153 and MDEV-20720.

This does not necessarily imply that wsrep GTID mode works perfectly in all other situations. If you discover any other issues with it, please report a bug.

GTIDs for Transactions Applied by Slave Thread

If a Galera Cluster node is also a , then that node's will be applying transactions that it replicates from its replication master. If the node has set, then each transaction that the applies will also generate a Galera Cluster write set that is replicated to the rest of the nodes in the cluster.

In and earlier, the node acting as slave would apply the transaction with the original GTID that it received from the master, and the other Galera Cluster nodes would generate their own GTIDs for the transaction when they replicated the write set.

In and later, the node acting as slave will include the transaction's original Gtid_Log_Event in the replicated write set, so all nodes should associate the write set with its original GTID. See MDEV-13431 about that.

This page is licensed: CC BY-SA / Gnu FDL

global transaction IDs (GTIDs)
MariaDB replication
GTID
GTID
MariaDB replication
GTID
GTID
slave SQL thread
GTID
GTID
GTIDs
GTIDs
GTIDs
log_slave_updates
log_bin
gtid_domain_id
GTIDs
sql_log_bin
server_id
GTIDs
replication slave
slave SQL thread
log_slave_updates=ON
slave SQL thread
MariaDB 10.5.1
MariaDB 10.5.1
MariaDB 10.5.1
MariaDB 10.5.1
MariaDB 10.1.30
MariaDB 10.1.31