DBAtlas · Database operations atlas

Skip a broken transaction (GTID)

MySQLReplication

Command

STOP REPLICA; SET GTID_NEXT='aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee:15'; BEGIN; COMMIT; SET GTID_NEXT='AUTOMATIC'; START REPLICA;

What it does

Commits an empty transaction for the specified GTID so that transaction counts as 'applied', and lets replication move on.

When to use it

When a duplicate/unappliable event on the replica stops replication, to skip that event.

Caution

Skipping a transaction creates data inconsistency between the replica and the source; use it only when you know the effect of the skipped event. Take the GTID value from Last_Error / Retrieved_Gtid_Set in SHOW REPLICA STATUS. If GTID is off, use SET GLOBAL sql_replica_skip_counter = 1; (8.0.26+; previously sql_slave_skip_counter, a deprecated alias in 8.0.26+).

Open in DBAtlas →

Related