Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
fzzf678 opened this issue Oct 14, 2024 · 2 comments · Fixed by #56786
Closed
Assignees
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. component/ddl This issue is related to DDL of TiDB. component/tablepartition This issue is related to Table Partition of TiDB. impact/panic severity/major type/bug The issue is confirmed as a bug. type/regression

Comments

@fzzf678
Copy link
Contributor

fzzf678 commented Oct 14, 2024

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

@fzzf678 fzzf678 added type/bug The issue is confirmed as a bug. component/ddl This issue is related to DDL of TiDB. labels Oct 14, 2024
@fzzf678
Copy link
Contributor Author

fzzf678 commented Oct 14, 2024

@mjonss please take a look

@mjonss
Copy link
Contributor

mjonss commented Oct 22, 2024

regression from #53544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. component/ddl This issue is related to DDL of TiDB. component/tablepartition This issue is related to Table Partition of TiDB. impact/panic severity/major type/bug The issue is confirmed as a bug. type/regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants