Skip to content

Unexpected full reload caused by failing to load schema diff #53442

@wjhuang2016

Description

@wjhuang2016

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Enable info schema cache V2 by setting DefTiDBSchemaCacheSize to 10.
  2. Add
	tk.MustExec(`drop view sys.schema_unused_indexes;`)

to the last of the test TestTimeBoundedStalenessTxn
3. Test TestTimeBoundedStalenessTxn and check log.

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

Partial reload for drop view sys.schema_unused_indexes

3. What did you see instead (Required)

[2024/05/21 16:14:36.358 +08:00] [INFO] [ddl.go:1182] ["start DDL job"] [category=ddl] [job="ID:106, Type:drop view, State:queueing, SchemaState:public, SchemaID:100, TableID:102, RowCount:0, ArgLen:0, start time: 2024-05-21 16:14:36.357 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"] [query="drop view sys.schema_unused_indexes;"]
[2024/05/21 16:14:36.359 +08:00] [INFO] [ddl_worker.go:1212] ["run DDL job"] [worker="worker 4, tp general"] [category=ddl] [jobID=106] [conn=1] [category=ddl] [job="ID:106, Type:drop view, State:queueing, SchemaState:public, SchemaID:100, TableID:102, RowCount:0, ArgLen:0, start time: 2024-05-21 16:14:36.357 +0800 CST, Err:<nil>, ErrCount:0, SnapshotVersion:0, LocalMode: false"]
[2024/05/21 16:14:36.360 +08:00] [ERROR] [domain.go:364] ["failed to load schema diff"] [error="[schema:1049]Unknown database '(Schema ID 100)'"] [errorVerbose="[schema:1049]Unknown database '(Schema ID 100)'\ngithub.com/pingcap/errors.AddStack\n\t/Users/bba/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/pingcap/[email protected]/errors.go:178\ngithub.com/pingcap/errors.(*Error).GenWithStackByArgs\n\t/Users/bba/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/pingcap/[email protected]/normalize.go:175\ngithub.com/pingcap/tidb/pkg/infoschema.(*Builder).applyTableUpdateV2\n\t/Users/bba/pc/tidb/pkg/infoschema/infoschema_v2.go:815\ngithub.com/pingcap/tidb/pkg/infoschema.applyTableUpdate\n\t/Users/bba/pc/tidb/pkg/infoschema/infoschema_v2.go:714\ngithub.com/pingcap/tidb/pkg/infoschema.applyDefaultAction\n\t/Users/bba/pc/tidb/pkg/infoschema/builder.go:315\ngithub.com/pingcap/tidb/pkg/infoschema.(*Builder).ApplyDiff\n\t/Users/bba/pc/tidb/pkg/infoschema/builder.go:102\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).tryLoadSchemaDiffs\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:544\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadInfoSchema\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:349\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Reload\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:679\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadSchemaInLoop\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:992\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Init.func2\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:1360\ngithub.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run.func1\n\t/Users/bba/pc/tidb/pkg/util/wait_group_wrapper.go:99\nruntime.goexit\n\t/Users/bba/.gvm/gos/go1.21.0/src/runtime/asm_arm64.s:1197"] [stack="github.com/pingcap/tidb/pkg/domain.(*Domain).loadInfoSchema\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:364\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Reload\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:679\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadSchemaInLoop\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:992\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Init.func2\n\t/Users/bba/pc/tidb/pkg/domain/domain.go:1360\ngithub.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run.func1\n\t/Users/bba/pc/tidb/pkg/util/wait_group_wrapper.go:99"]
[2024/05/21 16:14:36.369 +08:00] [INFO] [domain.go:388] ["full load InfoSchema success"] [currentSchemaVersion=52] [neededSchemaVersion=53] ["start time"=9.231875ms]

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions