br, ddl: BR restore failure - incremental restore a backup contains primary key and unique key #31835
Labels
component/br
This issue is related to BR of TiDB.
severity/major
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
on nightly build, create a cluster
execute sql
drop schema if exists db;
create schema db;
create table db.t1 (a int primary key nonclustered, b int unique);
insert into db.t1 values (42, 42);
take backup 1
./br backup db --db "db" --pd "172.16.4.2:2379" --storage "local:///backup/db"
execute sql
create table db.t1inc (a int primary key nonclustered, b int unique);
insert into db.t1inc values (42, 42);
alter table db.t1inc drop primary key;
drop table db.t1inc;
create table db.t1inc like db.t1;
insert into db.t1inc values (42, 42);
take backup 2
./br backup db --db "db" --pd "172.16.4.2:2379" --storage "local:///backup/dbinc"
execute sql
drop schema db;
restore backup 1
./br restore db --db "db" --pd "172.16.4.2:2379" --storage "local:///backup/db/"
restore backup 2
./br restore db --db "db" --pd "172.16.4.2:2379" --storage "local:///backup/dbinc/
2. What did you expect to see? (Required)
the second restore of step 8 shall succeed.
3. What did you see instead (Required)
the second restore of step 8 is failure, key failure log:
[2022-01-17T10:00:42.962Z] [2022/01/17 18:00:42.868 +08:00] [DEBUG] [txn.go:479] ["[kv] rollback txn"] [txnStartTS=430548881992581126] [2022-01-17T10:00:42.962Z] [2022/01/17 18:00:42.868 +08:00] [WARN] [glue.go:167] ["batch create table from tidb failure"] [error="[meta:1146]table doesn't exist"] [errorVerbose="[meta:1146]table doesn't exist\ngithub.com/pingcap/errors.AddStack\n\t/go/pkg/mod/github.com/pingcap/[email protected]/errors.go:174\ngithub.com/pingcap/errors.(*Error).GenWithStack\n\t/go/pkg/mod/github.com/pingcap/[email protected]/normalize.go:155\ngithub.com/pingcap/tidb/meta.(*Meta).checkTableExists\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/meta/meta.go:272\ngithub.com/pingcap/tidb/meta.(*autoIDAccessor).Inc\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/meta/meta_autoid.go:63\ngithub.com/pingcap/tidb/meta/autoid.(*allocator).rebase4Signed.func2\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/meta/autoid/autoid.go:358\ngithub.com/pingcap/tidb/kv.RunInNewTxn\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/kv/txn.go:49\ngithub.com/pingcap/tidb/meta/autoid.(*allocator).rebase4Signed\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/meta/autoid/autoid.go:333\ngithub.com/pingcap/tidb/meta/autoid.(*allocator).Rebase\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/meta/autoid/autoid.go:419\ngithub.com/pingcap/tidb/ddl.(*ddl).handleAutoIncID\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/ddl/ddl_api.go:2519\ngithub.com/pingcap/tidb/ddl.(*ddl).createTableWithInfoPost\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/ddl/ddl_api.go:2117\ngithub.com/pingcap/tidb/ddl.(*ddl).BatchCreateTableWithInfo\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/ddl/ddl_api.go:2251\ngithub.com/pingcap/tidb/br/pkg/gluetidb.(*tidbSession).CreateTables\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/br/pkg/gluetidb/glue.go:162\ngithub.com/pingcap/tidb/br/pkg/restore.(*DB).CreateTables\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/br/pkg/restore/db.go:192\ngithub.com/pingcap/tidb/br/pkg/restore.(*Client).createTables\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/br/pkg/restore/client.go:427\ngithub.com/pingcap/tidb/br/pkg/restore.(*Client).createTablesInWorkerPool.func1\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/br/pkg/restore/client.go:618\ngithub.com/pingcap/tidb/br/pkg/utils.(*WorkerPool).ApplyWithIDInErrorGroup.func1\n\t/home/jenkins/agent/workspace/br_ghpr_unit_and_integration_test/go/src/github.com/pingcap/br/br/pkg/utils/worker.go:82\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1371"]
4. What is your TiDB version? (Required)
Only nightly build / master branch
nightly build
it is possible to be introduced by batch create table (batch ddl)
The text was updated successfully, but these errors were encountered: