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

tidb panic while query hash partition table with is null condition #23802

Closed
aytrack opened this issue Apr 1, 2021 · 3 comments · Fixed by #23849
Closed

tidb panic while query hash partition table with is null condition #23802

aytrack opened this issue Apr 1, 2021 · 3 comments · Fixed by #23849
Assignees
Labels
severity/major sig/planner SIG: Planner sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Apr 1, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `NT_HP27193` (  `COL1` int(20) DEFAULT NULL,  `COL2` varchar(20) DEFAULT NULL,  `COL4` datetime DEFAULT NULL,  `COL3` bigint(20) DEFAULT NULL,  `COL5` float DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin PARTITION BY HASH ( `COL1`%`COL3` ) PARTITIONS 10;
select col1 from NT_HP27193 where col1 is null;

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

query successfully

3. What did you see instead (Required)

tidb panic

mysql > select col1 from NT_HP27193 where col1 is null;
(1105, 'runtime error: index out of range [1] with length 1')

tidb log:

[2021/04/01 15:50:02.572 +08:00] [ERROR] [conn.go:736] ["connection running loop panic"] [conn=231] [lastSQL="select col1 from NT_HP27193 where col1 is null"] [err="runtime error: index out of range [1] with length 1"] [stack="goroutine 33826544 [running]:\ngithub.com/pingcap/tidb/server.(*clientConn).Run.func1(0x4014780, 0xc032472ed0, 0xc02f879200)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/server/conn.go:734 +0xee\npanic(0x37a7460, 0xc031e720c0)\n\t/usr/local/go/src/runtime/panic.go:679 +0x1b2\ngithub.com/pingcap/tidb/util/chunk.Row.IsNull(...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/util/chunk/row.go:205\ngithub.com/pingcap/tidb/expression.(*Column).EvalInt(0xc028da8820, 0x406e1c0, 0xc02b02adc0, 0xc02a384a00, 0x0, 0x136136a, 0x35d81a0, 0x3938f60, 0x1)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/expression/column.go:367 +0x33b\ngithub.com/pingcap/tidb/expression.(*builtinArithmeticModIntSignedSignedSig).evalInt(0xc02a103810, 0xc02a384a00, 0x0, 0x0, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/expression/builtin_arithmetic.go:1125 +0x70\ngithub.com/pingcap/tidb/expression.(*ScalarFunction).EvalInt(0xc02a3845a0, 0x406e1c0, 0xc02b02adc0, 0xc02a384a00, 0x0, 0xc0310e3e00, 0x2, 0x8, 0xc02f073920)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/expression/scalar_function.go:378 +0xf3\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).findUsedPartitions(0x5fa3a60, 0x406e1c0, 0xc02b02adc0, 0x4057440, 0xc017dd7e40, 0x5fa4180, 0x0, 0x0, 0xc02d3bdad0, 0x1, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:145 +0x438\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).pruneHashPartition(0x5fa3a60, 0x406e1c0, 0xc02b02adc0, 0x4057440, 0xc017dd7e40, 0x5fa4180, 0x0, 0x0, 0xc02d3bdad0, 0x1, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:207 +0x113\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).processHashPartition(0x5fa3a60, 0xc028fad400, 0xc009373360, 0xc02a384460, 0x0, 0x409a840, 0xc02a384460)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:255 +0x163\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).prune(0x5fa3a60, 0xc028fad400, 0x10, 0x10, 0x389e040, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:555 +0x26d\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).rewriteDataSource(0x5fa3a60, 0x4068fe0, 0xc028fad400, 0x1, 0x389e040, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:64 +0x71d\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).rewriteDataSource(0x5fa3a60, 0x40699e0, 0xc029e82d20, 0x0, 0xc007cdb500, 0x36cd180, 0xc007cdb500)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:92 +0x62a\ngithub.com/pingcap/tidb/planner/core.(*partitionProcessor).optimize(0x5fa3a60, 0x4014780, 0xc02434f980, 0x40699e0, 0xc029e82d20, 0x40699e0, 0xc029e82d20, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/rule_partition_processor.go:57 +0x3f\ngithub.com/pingcap/tidb/planner/core.logicalOptimize(0x4014780, 0xc02434f980, 0x22a2, 0x40699e0, 0xc029e82d20, 0x60657b2a, 0xc029bae400, 0x13dfbc6, 0x60657b2a)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/optimizer.go:206 +0x116\ngithub.com/pingcap/tidb/planner/core.DoOptimize(0x4014780, 0xc02434f980, 0x406e1c0, 0xc02b02adc0, 0x2a2, 0x40699e0, 0xc029e82d20, 0x0, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/core/optimizer.go:140 +0x77\ngithub.com/pingcap/tidb/planner.optimize(0x4014780, 0xc02434f980, 0x406e1c0, 0xc02b02adc0, 0x4033240, 0xc031853900, 0x4060060, 0xc02413f450, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/tidb_master/go/src/github.com/pingcap/tidb/planner/optimize.go:289 +0x66c\ngithub.com/pingcap/tidb/planner.Optimize(0x4014780, 0xc02434f980, 0x406e1c0, 0xc02b02ad"]

4. What is your TiDB version? (Required)

tidb_version() | Release Version: v4.0.0-beta.2-2527-gd0291c802-dirty
Edition: Community
Git Commit Hash: d0291c802a8663e00530d04f6eb73a9f044dc844
Git Branch: master
UTC Build Time: 2021-03-31 19:38:58
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@aytrack aytrack added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major labels Apr 1, 2021
@aytrack aytrack changed the title tidb panic: runtime error: index out of range [1] with length 1 tidb panic while query hash partition table with is null condition Apr 1, 2021
@Howie59
Copy link
Contributor

Howie59 commented Apr 1, 2021

/assign

@zimulala
Copy link
Contributor

zimulala commented Apr 6, 2021

It can reproduce on release-5.0, and can't reproduce on v4.0.12.

@xiongjiwei xiongjiwei added sig/planner SIG: Planner and removed sig/sql-infra SIG: SQL Infra labels Jun 2, 2021
@qw4990 qw4990 added sig/sql-infra SIG: SQL Infra and removed sig/planner SIG: Planner labels Jun 2, 2021
@qw4990 qw4990 added the sig/planner SIG: Planner label Jun 4, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/planner SIG: Planner 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.

6 participants