It is everywhere in the world of MySQL that if your replication
is broken because an event caused a duplicate key or a row was
not found and it cannot be updated or deleted, then you can use ‘
STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;
’ and be done with it. In some cases this is fine and you
can repair the offending row or statements later on. But what if
the statement is part of a multi-statement transaction? Well,
then it becomes more interesting, because skipping the offending
statement will cause the whole transaction to be skipped. This is
well documented in the manual by the way. So here’s
a quick example.
3 rows on the master:
master> select * from t;
+----+-----+
| id | pid |
+----+-----+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
+----+-----+
3 rows in set (0.00 …
[Read more]