Skip to content

tidb panic while change list partition table columns #38932

Closed
@aytrack

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1, t2, t3;
create table t1 (a tinyint, b int) partition by range (a + b) (
    partition p0 values less than (10)
);
create table t2 (a tinyint, b int) partition by hash(a + b) partitions 5;
create table t3 (a char, b char) partition by range columns (a) (
    partition p0 values less than ('z')
);
alter table t3 change a c char;

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

change column report error

mysql> alter table t3 change a c char;
ERROR 3855 (HY000): Column 'a' has a partitioning function dependency and cannot be dropped or renamed.

3. What did you see instead (Required)

mysql> alter table t3 change a c char;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
[2022/11/07 15:07:59.234 +08:00] [ERROR] [conn.go:1058] ["connection running loop panic"] [conn=2199023256021] [lastSQL="alter table t3 change a c char"] [err="runtime error: invalid memory address or nil pointer dereference"] [stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1061\nruntime.gopanic\n\t/usr/local/go1.19.1/src/runtime/panic.go:884\ngithub.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:438\nruntime.gopanic\n\t/usr/local/go1.19.1/src/runtime/panic.go:884\nruntime.panicmem\n\t/usr/local/go1.19.1/src/runtime/panic.go:260\nruntime.sigpanic\n\t/usr/local/go1.19.1/src/runtime/signal_unix.go:835\ngithub.com/pingcap/tidb/ddl.collectColumnsType\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/partition.go:1142\ngithub.com/pingcap/tidb/ddl.buildRangePartitionDefinitions\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/partition.go:1154\ngithub.com/pingcap/tidb/ddl.buildPartitionDefinitionsInfo\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/partition.go:1026\ngithub.com/pingcap/tidb/ddl.GetModifiableColumnJob\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/ddl_api.go:4689\ngithub.com/pingcap/tidb/ddl.(*ddl).getModifiableColumnJob\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/ddl_api.go:4495\ngithub.com/pingcap/tidb/ddl.(*ddl).ChangeColumn\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/ddl_api.go:4934\ngithub.com/pingcap/tidb/ddl.(*ddl).AlterTable\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/ddl/ddl_api.go:3312\ngithub.com/pingcap/tidb/executor.(*DDLExec).executeAlterTable\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/ddl.go:377\ngithub.com/pingcap/tidb/executor.(*DDLExec).Next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/ddl.go:147\ngithub.com/pingcap/tidb/executor.Next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:325\ngithub.com/pingcap/tidb/executor.(*ExecStmt).next\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1118\ngithub.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:891\ngithub.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:739\ngithub.com/pingcap/tidb/executor.(*ExecStmt).Exec\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:544\ngithub.com/pingcap/tidb/session.runStmt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:2333\ngithub.com/pingcap/tidb/session.(*session).ExecuteStmt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/session/session.go:2197\ngithub.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/driver_tidb.go:233\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2065\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1920\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1374\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1123\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:625"]

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                   |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.4.0
Edition: Community
Git Commit Hash: 00b99ec17ec4345db07849327cc16295e75235e4
Git Branch: heads/refs/tags/v6.4.0
UTC Build Time: 2022-11-05 00:17:30
GoVersion: go1.19.1
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions