Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 误删数据后怎么恢复?时间点在tikv_gc_safe_point之前
【TiDB Usage Environment】Production\Test Environment\POC
【TiDB Version】V5.0.0
【Encountered Problem】Accidentally deleted some data and want to restore to the point before the deletion. The deletion time is before tikv_gc_safe_point. Thank you!
【Reproduction Path】What operations were performed that caused the problem
【Problem Phenomenon and Impact】
Is there any way to recover the data before the GC time point?
If you have a backup, you can restore it. If not, it cannot be restored.
It is not possible to restore based on historical version information. It is recommended to use database backups for recovery.
You can try and see if it can be undetected. If there are binary logs, it can be restored.
There is synchronization to the downstream through pump+drainer, but in this way, the downstream also executes delete, right? Is it impossible to recover?
First, check if there is a GC. If not, you can only restore the entire database and then import the deleted data.
Drainer can output to a downstream file format. If you have a full backup and binlog within a specific time range, you can restore it.
Our drainer is currently syncing to the downstream TiDB. How can we proceed? Thank you!
If you haven’t modified the GC time of your pump, it should be 7 days by default. You can restart a drainer component and set it to file. Then, set the TSO for the drainer startup to a point before the deletion time, and it should work.
Pump is 7 days, I’ll give it a try, thank you!