Skip to content

Panic after inject an error in onReorganizePartition in StateDeleteReorganization state #56634

@fzzf678

Description

@fzzf678

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Ref: https://github.com/pingcap/tidb/compare/master...fzzf678:tidb:test_partition?expand=1

  1. inject a error an StateDeleteReorganization state, mock error for updateVersionAndTableInfo
  2. run sql like: alter table t partition by range(a) (partition p1 values less than (20))

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

no panic

3. What did you see instead (Required)

panic

[2024/10/14 16:03:13.188 +08:00] [ERROR] [misc.go:115] ["panic in the recoverable goroutine"] [label=domain] [funcInfo=loadSchemaInLoop] [r="runtime error: index out of range [0] with length 0"] [stack="github.com/pingcap/tidb/pkg/util.Recover\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/util/misc.go:119\nruntime.gopanic\n\t/Users/fanzhou/.gvm/pkgsets/go1.22.4/global/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:785\nruntime.goPanicIndex\n\t/Users/fanzhou/.gvm/pkgsets/go1.22.4/global/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:115\ngithub.com/pingcap/tidb/pkg/table/tables.getRangeLocateExprs\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:754\ngithub.com/pingcap/tidb/pkg/table/tables.generateRangePartitionExpr\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:719\ngithub.com/pingcap/tidb/pkg/table/tables.newPartitionExpr\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:280\ngithub.com/pingcap/tidb/pkg/table/tables.newPartitionedTable\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:158\ngithub.com/pingcap/tidb/pkg/table/tables.TableFromMeta\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/tables.go:226\ngithub.com/pingcap/tidb/pkg/infoschema.tableFromMeta\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/infoschema/builder.go:916\ngithub.com/pingcap/tidb/pkg/infoschema.(*Builder).createSchemaTablesForDB\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/infoschema/builder.go:945\ngithub.com/pingcap/tidb/pkg/infoschema.(*Builder).InitWithDBInfos\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/infoschema/builder.go:896\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadInfoSchema\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:386\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Reload\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:766\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadSchemaInLoop\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:1104\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Start.func2\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:1495\ngithub.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run.func1\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/util/wait_group_wrapper.go:99"] [stack="github.com/pingcap/tidb/pkg/util.Recover\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/util/misc.go:115\nruntime.gopanic\n\t/Users/fanzhou/.gvm/pkgsets/go1.22.4/global/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:785\nruntime.goPanicIndex\n\t/Users/fanzhou/.gvm/pkgsets/go1.22.4/global/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:115\ngithub.com/pingcap/tidb/pkg/table/tables.getRangeLocateExprs\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:754\ngithub.com/pingcap/tidb/pkg/table/tables.generateRangePartitionExpr\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:719\ngithub.com/pingcap/tidb/pkg/table/tables.newPartitionExpr\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:280\ngithub.com/pingcap/tidb/pkg/table/tables.newPartitionedTable\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/partition.go:158\ngithub.com/pingcap/tidb/pkg/table/tables.TableFromMeta\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/table/tables/tables.go:226\ngithub.com/pingcap/tidb/pkg/infoschema.tableFromMeta\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/infoschema/builder.go:916\ngithub.com/pingcap/tidb/pkg/infoschema.(*Builder).createSchemaTablesForDB\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/infoschema/builder.go:945\ngithub.com/pingcap/tidb/pkg/infoschema.(*Builder).InitWithDBInfos\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/infoschema/builder.go:896\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadInfoSchema\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:386\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Reload\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:766\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).loadSchemaInLoop\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:1104\ngithub.com/pingcap/tidb/pkg/domain.(*Domain).Start.func2\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/domain/domain.go:1495\ngithub.com/pingcap/tidb/pkg/util.(*WaitGroupEnhancedWrapper).Run.func1\n\t/Users/fanzhou/Documents/GitHub/tidb/pkg/util/wait_group_wrapper.go:99"]

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