Lets start by considering a scenario where records are being inserted in a single auto-increment table via different nodes of a multi-master cluster. One issue that might arise is ‘collision’ of generated auto-increment values on different nodes, which is precisely the subject of this article.

As the cluster is multi-master, it allows writes on all master nodes. As a result of which a table might get same auto-incremented values on different nodes on INSERTs. This issue is discovered only after the writeset is replicated and that’s a problem!

Galera cluster suffers with the similar problem.

Lets try to emulate this on a 2-node Galera cluster :

As expected, the second commit could not succeed because of the collision.

So, how do we handle this issue? Enter @@auto_increment_increment and @@auto_increment_offset! Using these two system variables one can control the sequence of auto-generated values on a MySQL/MariaDB server. The trick is to set them in such a way that every node in the cluster generates a sequence of non-colliding numbers.

For instance, lets discuss this for a 3-node cluster (n=3):

As you can see, by setting each node’s auto_increment_increment to the total number of nodes (n) in the cluster and auto_increment_offset to a number between [1,n], we can assure that auto-increment values, thus generated, would be unique across the cluster, thus, would avoid any conflict or collision.

In Galera cluster this is already taken care of by default. As and when a node joins the cluster, the two auto-increment variables are adjusted automatically to avoid collision. However, this capability can be controlled by using wsrep_auto_increment_control variable.

With this setting the last COMMIT in the above example would succeed.

The MariaDB project is pleased to announce the immediate availability of MariaDB Galera Cluster 5.5.35. This is a Stable release.

See the Release Notes and Changelog for detailed information on this release and the Galera page in the MariaDB Knowledge Base for general information about MariaDB Galera Cluster.

Download MariaDB Galera Cluster 5.5.35

Release Notes Changelog About MariaDB Galera Cluster

Thanks, and enjoy MariaDB!

After some final testing and polishing, the MariaDB project and Codership are pleased to announce the release of MariaDB Galera Cluster 5.5.29. This is a Stable (GA) release. MariaDB Galera Cluster links:

About MariaDB Galera Cluster

MariaDB Galera Cluster is made for today’s cloud based environments. It is fully read-write scalable, comes with synchronous replication, allows multi-master topologies, and guarantees no lag or lost transactions. Some of its features & benefits are listed below.

Features

  • Synchronous replication
  • Active-active multi-master topology
  • Read and write to any cluster node
  • Automatic membership control, with failed nodes dropped from the cluster
  • Automatic node joining
  • True row-level parallel replication
  • Direct client connections, native MariaDB/MySQL look & feel

Benefits

The above features yield several benefits for a database clustering solution, including:

  • No slave lag
  • No lost transactions
  • Both read and write scalability
  • Smaller client latencies

Technology

MariaDB Galera Cluster uses the Galera library for the replication implementation. To interface with Galera replication, we have enhanced MariaDB to support the replication API definition in the Write Set REPlication (wsrep API) project. The implementation of the replication API in MariaDB happens in the open source MySQL-wsrep project.

User Feedback plugin

MariaDB Galera Cluster includes a User Feedback plugin. This plugin is disabled by default. If enabled, it submits basic, completely anonymous usage information. This information is used by the developers to track trends in usage to better guide development efforts. If you would like to help make MariaDB Galera Cluster better, please add “feedback=ON” to your my.cnf file! See the User Feedback Plugin page for more information.

Quality

The project always strives for quality, but in reality, nothing is perfect. Please take time to report any issues you encounter at: http://mariadb.org/jira. We hope you enjoy MariaDB Galera Cluster!

Operations Support

Once you run MariaDB Galera Cluster in production you want to make sure there is a helping hand available whenever needed. We’re happy to inform you that our partner SkySQL offers 24-hour support also for the MariaDB Galera Cluster, see SkySQL’s page about Galera Cluster.