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

infoschema: panic occurred when applying default charset modification for databases named in uppercase. #19273

Closed
bb7133 opened this issue Aug 18, 2020 · 0 comments · Fixed by #19286
Assignees
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@bb7133
Copy link
Member

bb7133 commented Aug 18, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

tidb> DROP DATABASE IF EXISTS A;
Query OK, 0 rows affected (0.02 sec)

tidb> CREATE DATABASE A DEFAULT CHARACTER SET utf8;
Query OK, 0 rows affected (0.01 sec)

tidb> ALTER DATABASE A DEFAULT CHARACTER SET utf8mb4;

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

tidb> ALTER DATABASE A DEFAULT CHARACTER SET utf8mb4;
Query OK, 0 rows affected (0.01 sec)

3. What did you see instead (Required)

ALTER DATABASE A DEFAULT CHARACTER SET utf8mb4;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

4. What is your TiDB version? (Required)

v4.0.4

Others

TiDB panic stack:

[2020/08/19 00:16:16.337 +08:00] [ERROR] [conn.go:660] ["connection running loop panic"] [conn=1] [lastSQL="ALTER DATABASE A DEFAULT CHARACTER SET utf8mb4"] [err="runtime error: invalid memory address or nil pointer dereference"] [stack="goroutine 315 [running]:
github.com/pingcap/tidb/server.(*clientConn).Run.func1(0x3763880, 0xc00098f770, 0xc00073cea0)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/server/conn.go:658 +0xee
panic(0x2e71a00, 0x4b550d0)
	/home/bb7133/Softwares/go/src/runtime/panic.go:679 +0x1b2
github.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1(0xc00113c480, 0xc000b287c8, 0xc000b287a8)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/executor/adapter.go:283 +0x544
panic(0x2e71a00, 0x4b550d0)
	/home/bb7133/Softwares/go/src/runtime/panic.go:679 +0x1b2
github.com/pingcap/tidb/infoschema.(*Builder).copySchemaTables(0xc000b27930, 0x4be55c1, 0x1, 0x0)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/infoschema/builder.go:368 +0x79
github.com/pingcap/tidb/infoschema.(*Builder).applyModifySchemaCharsetAndCollate(0xc000b27930, 0xc000a89620, 0xc000fb6540, 0x1, 0xc000502590)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/infoschema/builder.go:190 +0x8c
github.com/pingcap/tidb/infoschema.(*Builder).ApplyDiff(0xc000b27930, 0xc000a89620, 0xc000fb6540, 0xc000ba7230, 0x1, 0xc0011d2928, 0x0, 0x1)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/infoschema/builder.go:49 +0x931
github.com/pingcap/tidb/domain.(*Domain).tryLoadSchemaDiffs(0xc00052b440, 0xc000a89620, 0xa1, 0xa1, 0xa1, 0x0, 0x0, 0xc000b27a20, 0x14a53a4, 0xc000751540)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/domain/domain.go:260 +0x384
github.com/pingcap/tidb/domain.(*Domain).loadInfoSchema(0xc00052b440, 0xc0002ed940, 0xa0, 0x5d0096d77400000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/domain/domain.go:121 +0x305
github.com/pingcap/tidb/domain.(*Domain).Reload(0xc00052b440, 0x0, 0x0)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/domain/domain.go:360 +0x1a5
github.com/pingcap/tidb/domain.(*ddlCallback).OnChanged(0xc0005766d8, 0x0, 0x0, 0x0, 0x1)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/domain/domain.go:626 +0x8d
github.com/pingcap/tidb/ddl.(*ddl).callHookOnChanged(0xc000b84420, 0x0, 0x0, 0x0, 0x0)
	/home/bb7133/Projects/gopath/src/github.com/pingcap/tidb/ddl/ddl.go:524 +0xbc
github.com/pingcap/tidb/ddl.(*ddl).AlterSchema(0xc000b84420, 0x37a6e00, 0xc0009e4d00, 0xc00054b580, 0xc00052b440, 0x306c720)
...
  • Looks that if the name of database is lower-case only, the ALTER ... statement runs just fine.
  • The panic happened when 'incremental' diff is applied for the information schema builder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants