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\ngit.luolix.top/pingcap/errors.AddStack\n\t/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20211224045212-9687c2b0f87c/errors.go:174\ngit.luolix.top/pingcap/errors.(*Error).GenWithStack\n\t/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20211224045212-9687c2b0f87c/normalize.go:155\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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\ngit.luolix.top/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/sync@v0.0.0-20210220032951-036812b2e83c/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: