Closed Leavrth closed 3 months ago
time line
|
start a log task -----> | -----> T0, save table infos at T0, not having table test.t1
|
create a table test.t1 -----> |
|
full backup -----> | -----> T1, save table infos at T1, having table test.t1
|
insert rows into test.t1 -----> |
|
v
time line
|
full restore -----> | -----> downstream having table test.t1
|
log restore -----> | -----> use table infos at T0 as based upstream tables' view, however test.t1 is not exist.
| Therefore, it doesn't know the table id of test.t1, and then doesn't know which data belongs to test.t1
|
v
# workload 1
mysql --host 127.0.0.1 --port 4000 -u root -e "CREATE TABLE test.t1(id int primary key, a char(20));"
# start a log backup task
tiup br:v8.1.0 log start --task-name pitr -s "local:///root/backups/test1/log" -u 127.0.0.1:2379
# backup full -- BackupTS 450884656681451549
tiup br:v8.1.0 backup full -s "local:///root/backups/test1/full" -u 127.0.0.1:2379
# workload 2
mysql --host 127.0.0.1 --port 4000 -u root -e "CREATE TABLE test.t2(id int primary key, a char(20));"
mysql --host 127.0.0.1 --port 4000 -u root -e "INSERT INTO test.t1 values (1, '1');"
# incremental backup -- BackupTS 450884684363857924
tiup br:v8.1.0 backup full -s "local:///root/backups/test1/incremental" -u 127.0.0.1:2379 --lastbackupts 450884656681451549
# workload 3
mysql --host 127.0.0.1 --port 4000 -u root -e "REPLACE INTO test.t1 values (1, '2');"
mysql --host 127.0.0.1 --port 4000 -u root -e "REPLACE INTO test.t2 values (1, '2');"
$ mysql --host 127.0.0.1 --port 4000 -u root -e "SELECT * FROM test.t1;"
+----+------+
| id | a |
+----+------+
| 1 | 2 |
+----+------+
$ mysql --host 127.0.0.1 --port 4000 -u root -e "SELECT * FROM test.t2;"
+----+------+
| id | a |
+----+------+
| 1 | 2 |
+----+------+
# full restore
tiup br:v8.1.0 restore full -s "local:///root/backups/test1/full" -u 127.0.0.1:2379
# incremental restore
tiup br:v8.1.0 restore full -s "local:///root/backups/test1/incremental" -u 127.0.0.1:2379
# log restore
tiup br:v8.1.0 restore point -s "local:///root/backups/test1/log" -u 127.0.0.1:2379 --start-ts 450884684363857924
# Case - Rewrite TS overrided
$ mysql --host 127.0.0.1 --port 4000 -u root -e "SELECT * FROM test.t1;"
+----+------+
| id | a |
+----+------+
| 1 | 1 |
+----+------+
# Case - No Rewrite Rule Find
$ mysql --host 127.0.0.1 --port 4000 -u root -e "SELECT count(*) FROM test.t2;"
+----------+
| count(*) |
+----------+
| 0 |
+----------+
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
test.t1
.T1
.T1
.2. What did you expect to see? (Required)
There is one row in the table
test.t1
.3. What did you see instead (Required)
There is no row in the table
test.t1
.4. What is your TiDB version? (Required)
v6.5, v7.1, v7.5, v8.1