I accidentally deleted some data, and it's been over 6 hours. The backup set is very large. How can I recover these few pieces of data?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 我误删了几条数据了,已经过了6个小时了,备份集很大很大,怎么能恢复呢这几条数据呢?

| username: TiGod

How to restore it?

| username: Jiawei | Original post link

If the GC’s snapshot time is still within range, see if you can restore it. This should be the simplest method. However, the prerequisite is that the snapshot still exists.

| username: Jiawei | Original post link

If the snapshot time point that can be flushed happens to be,
flush to the new table, query it, and update it back.

| username: TiGod | Original post link

No, it has already been garbage collected.

| username: xingzhenxiang | Original post link

It seems we can only look for backups.

| username: db_user | Original post link

What is the architecture like? Does it include CDC, binlog, etc., or is it just a simple cluster?

| username: caiyfc | Original post link

Is the backup logical or physical?

| username: TiGod | Original post link

I use BR for backup.

| username: TiGod | Original post link

Binlog is enabled, but I’m not sure if it’s really enabled, and I don’t know where the directory is.

| username: db_user | Original post link

According to the official website, there are configuration options. Check what your configuration looks like, the positions of pumper and drainer, and where the output goes.

| username: tony5413 | Original post link

If you can’t use flashback, then use binlog.

| username: 孤君888 | Original post link

Restore using backup + binlog.

| username: 考试没答案 | Original post link

This solution is feasible. Output to a file. You are performing a keyword search.

| username: 考试没答案 | Original post link

We only need those few pieces of data. We can set the start time and end time. Approximately a few time periods should be enough.

| username: Billmay表妹 | Original post link

You can use the Flashback feature introduced in TiDB v6.4.0 to quickly restore data. You can restore data to a specified point in time, as long as it is within the GC time. For specific operations, please refer to Flashback Cluster and Flashback Database.

| username: caiyfc | Original post link

If you have a BR backup, you can directly use the BR backup data to restore the table with the deleted data. To be safe, you can set up a separate single-node cluster for the restoration.

| username: liuis | Original post link

If there is br, it should be feasible.

| username: TiGod | Original post link

Isn’t the default GC time for TiDB 5 minutes? It passed so quickly.

| username: TiGod | Original post link

However, does the incremental data also need to be restored using binlog? It’s uncertain whether there have been any changes recorded during the period from backup to deletion.

| username: TiGod | Original post link

Setting the GC time too long will affect performance, won’t it?