Databases 4 min read

Recovering a Single Table on a MySQL Slave When GTID Replication Errors Occur

This article explains how to restore a single table on a MySQL replica after GTID‑based replication errors by using backup snapshots, replication filters, and controlled start‑up points to keep data consistent across master and slave.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Recovering a Single Table on a MySQL Slave When GTID Replication Errors Occur

When a table on a MySQL replica becomes inconsistent with the master and replication stops with a GTID error, rebuilding the whole replica can be time‑consuming; the following methods show how to recover only the affected table.

Scenario 1

If replication stopped and no error‑skip or filter was applied, the master continues updating while the replica is stuck at GTID aaaa:1-100.

Correct repair steps:

Backup table t on the master (snapshot GTID aaaa:1-10000).

Restore the backup to the replica.

Start replication, skipping the transactions that modify t between GTID aaaa:101 and aaaa:10000.

Implementation example:

CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE = ('db_name.t');

Then start replication up to the snapshot point:

START SLAVE UNTIL SQL_AFTER_GTIDS = 'aaaa:10000';

Finally, remove the replication filter and resume normal replication. Use mysqldump --single-transaction --master-data=2 to record the GTID of the backup.

Scenario 2

If error‑skip or filtering was already used and both master and replica keep updating, the replica may miss transactions that modify t between GTID aaaa:10001 and aaaa:20000.

Correct repair steps:

Lock table t for read on the replica.

Backup table t on the master.

Stop replica replication, restore the backup of t.

Start replication.

Unlock table t.

For large tables, consider using transportable tablespace to reduce lock time.

Keywords: #replication #data recovery #GTID

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Data ConsistencymysqlReplicationBackupGTIDTable Recovery
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.