I am currently working on a script to auto-enable parallel replication / multi-threaded replication (MTR) when there is replication lag. For testing this script, I need to trigger replication lag that would disappear after enabling MTR. I came-up with a simple solution for that, and I thought it could be useful to more people, so I am writing this blog post about it. Read-on for the details.
TL;DR: unless you know what you are doing, you should always have a primary key on your tables when replicating in RBR (and maybe even all the time).
TL;DR2: MariaDB 10.1 has an interesting way to protect against missing a primary key (innodb_force_primary_key) but it could be improved.
A few weeks ago, I was called off hours because replication delay on all the slaves from a replication chain
A funny replication breakage kept me at the office longer than expected today (Friday 13 is not kind with me).
So question of the day: can you guess what the below UPDATE statement does (or what is wrong with it)?
> CREATE TABLE test_jfg ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, status ENUM('a','b') NOT NULL DEFAULT 'a', txt TEXT); Query OK, 0
The other day, I was discussing high availability (HA)
with other people. The discussion was going in the
direction of, as the application was only using INSERT ... ON DUPLICATE KEY
UPDATE (ODKU) and traffic could be replayed,
promoting a slave in case of the failure of the master was easy:
replaying traffic would make all the slaves converge
back to a common state. It looks as this could work but it
might not be as simple. Before going into the details,
let's take a step back and look into HA in general.
tl;dr: be careful when using row-based replication when replicating ODKU as slaves will stop replicating if a row is present on the master and missing on slave (or vice-versa).
High Availability by Promoting a Slave as the new Master
Let's suppose we are working …