Skip to content

BR: restore panic when backup has duplicate database and table name. #40797

@3pointer

Description

@3pointer

Bug Report

Please answer these questions before submitting your issue. Thanks!

Normally we wouldn't have a duplicate table names in same cluster. but for system tables. we use temporary database __TiDB_BR_Temporary_mysql to store system tables. This may cause the problem.

1. Minimal reproduce step (Required)

  1. run tiup playground
  2. run create database __TiDB_BR_Temporary_mysql and create table tables_priv(id int) (anyone is as same as mysql database.)
  3. run br backup full --pd xxx -s 'local://tmp/bk01'
  4. run br restore full --pd xxx -s 'local://tmp/bk01'

2. What did you expect to see? (Required)

restore success

3. What did you see instead (Required)

panic due to we restore tables_priv twice.

panic: bug! table done before register!

goroutine 530 [running]:
go.uber.org/zap/zapcore.CheckWriteAction.OnWrite(0x2?, 0x2?, {0x0?, 0x0?, 0xc0006c33a0?})
	/go/pkg/mod/go.uber.org/zap@v1.23.0/zapcore/entry.go:198 +0x65
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc001459930, {0xc0021ab000, 0x2, 0x2})
	/go/pkg/mod/go.uber.org/zap@v1.23.0/zapcore/entry.go:264 +0x3ec
go.uber.org/zap.(*Logger).Panic(0xc0021ab000?, {0x4cc400a?, 0x18c7ceb?}, {0xc0021ab000, 0x2, 0x2})
	/go/pkg/mod/go.uber.org/zap@v1.23.0/logger.go:251 +0x59
github.com/pingcap/log.Panic({0x4cc400a?, 0xe?}, {0xc0021ab000?, 0xc000bd59e0?, 0xc0ed4fb21799f4a0?})
	/go/pkg/mod/github.com/pingcap/log@v1.1.1-0.20221116035753-734d527bc87c/global.go:54 +0x8b
github.com/pingcap/tidb/br/pkg/restore.(*tikvSender).waitTablesDone(0xc0000fa9b0, {0xc0021d2600?, 0x9, 0xc001f7dba0?})
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/restore/pipeline_items.go:351 +0x295
github.com/pingcap/tidb/br/pkg/restore.(*tikvSender).restoreWorker.func2()
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/restore/pipeline_items.go:390 +0x452
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/go/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:72 +0xa5

4. What is your TiDB version? (Required)

v6.5.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions