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

query partition table with limit report runtime error: index out of range [0] with length 0 #45804

Closed
aytrack opened this issue Aug 4, 2023 · 3 comments · Fixed by #45824
Closed
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. report/community The community has encountered this bug. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Aug 4, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t;
create table t(
    id int(10) default null,
    Uid bigint(20) unsigned not null primary key,
    bid varchar(50) default null,
    index idx(bid)
) partition by hash(Uid) partitions 10;
 insert into t values (1,1,1), (2,2,2), (3,3,3),(4,4,4), (5,5,5);
 set tidb_partition_prune_mode='dynamic';
analyze table t;
select * from t limit 1;

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

query success

3. What did you see instead (Required)

select * from t limit 1;
(1105, 'runtime error: index out of range [0] with length 0')

tidb log

[2023/08/04 09:30:25.914 +08:00] [ERROR] [conn.go:1072] ["connection running loop panic"] [conn=5250810137421021591] [lastSQL="select * from t as a limit 1"] [err="runtime error: index out of range [0] with length 0"] [stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1075
runtime.gopanic
	/usr/local/go1.20.5/src/runtime/panic.go:884
github.com/pingcap/tidb/server.(*clientConn).writeResultSet.func1
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2237
runtime.gopanic
	/usr/local/go1.20.5/src/runtime/panic.go:884
runtime.goPanicIndex
	/usr/local/go1.20.5/src/runtime/panic.go:113
github.com/pingcap/tidb/util/chunk.(*Column).IsNull
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/column.go:169
github.com/pingcap/tidb/util/chunk.Row.IsNull
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/util/chunk/row.go:218
github.com/pingcap/tidb/server.dumpTextRow
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/util.go:401
github.com/pingcap/tidb/server.(*clientConn).writeChunks
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2353
github.com/pingcap/tidb/server.(*clientConn).writeResultSet
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2256
github.com/pingcap/tidb/server.(*clientConn).handleStmt
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2124
github.com/pingcap/tidb/server.(*clientConn).handleQuery
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1885
github.com/pingcap/tidb/server.(*clientConn).dispatch
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1372
github.com/pingcap/tidb/server.(*clientConn).Run
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1153
github.com/pingcap/tidb/server.(*Server).onConn
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:677"]

4. What is your TiDB version? (Required)

v7.1.1
master(522a008)

@aytrack aytrack added type/bug The issue is confirmed as a bug. severity/major component/tablepartition This issue is related to Table Partition of TiDB. affects-7.1 This bug affects the 7.1.x(LTS) versions. labels Aug 4, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Aug 4, 2023
@aytrack aytrack removed may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 labels Aug 4, 2023
@aytrack
Copy link
Contributor Author

aytrack commented Aug 4, 2023

introduced by #45158

@winoros
Copy link
Member

winoros commented Aug 4, 2023

It's a very strict reproduce env. If you don't select *, select a, b instead. You won't trigger this bug.

@seiya-annie
Copy link

/found community

@ti-chi-bot ti-chi-bot bot added the report/community The community has encountered this bug. label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. component/tablepartition This issue is related to Table Partition of TiDB. report/community The community has encountered this bug. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants