You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
drop table if exists t1, t2;
create table t1 (c_int int, c_datetime datetime, primary key (c_datetime)) partition by range (to_days(c_datetime)) ( partition p0 values less than (to_days('2020-02-01')), partition p1 values less than (to_days('2020-04-01')), partition p2 values less than (to_days('2020-06-01')), partition p3 values less than maxvalue) ;
create table t2 (c_int int, primary key (c_int));
insert into t1 (c_int, c_datetime) values (7, '2020-03-03 01:06:02');
insert into t2 (c_int) values (1);
begin;
select * from t1 left join t2 on t1.c_int = t2.c_int for update;
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
drop table if exists t1, t2;
create table t1 (c_int int, c_datetime datetime, primary key (c_datetime)) partition by range (to_days(c_datetime)) ( partition p0 values less than (to_days('2020-02-01')), partition p1 values less than (to_days('2020-04-01')), partition p2 values less than (to_days('2020-06-01')), partition p3 values less than maxvalue) ;
create table t2 (c_int int, primary key (c_int));
insert into t1 (
c_int
,c_datetime
) values (7, '2020-03-03 01:06:02');insert into t2 (
c_int
) values (1);begin;
select * from t1 left join t2 on t1.c_int = t2.c_int for update;
2. What did you expect to see? (Required)
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from t1 left join t2 on t1.c_int = t2.c_int for update;
+-------+---------------------+-------+
| c_int | c_datetime | c_int |
+-------+---------------------+-------+
| 7 | 2020-03-03 01:06:02 | NULL |
+-------+---------------------+-------+
1 row in set (0.01 sec)
3. What did you see instead (Required)
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from t1 left join t2 on t1.c_int = t2.c_int for update;
ERROR 1105 (HY000): runtime error: index out of range [3] with length 3
log in tidb server:
[2021/04/19 07:08:14.861 +00:00] [INFO] [region_cache.go:971] ["switch region leader to specific leader due to kv return NotLeader"] [regionID=1557] [currIdx=1] [leaderStoreID=1]
[2021/04/19 07:08:14.862 +00:00] [ERROR] [projection.go:448] ["projection executor panicked"] [error="runtime error: index out of range [3] with length 3"] [stack="goroutine 20578943 [running]:\ngithub.jparrowsec.cn/pingcap/tidb/util.GetStack(...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/misc.go:74\ngithub.jparrowsec.cn/pingcap/tidb/executor.recoveryProjection(0xc0014db8f0, 0x378df20, 0xc001f6f460)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:447 +0x90\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*projectionInputFetcher).run.func1(0xc000aacf80, 0xc003549ca0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:349 +0x82\npanic(0x378df20, 0xc001f6f460)\n\t/usr/local/go/src/runtime/panic.go:679 +0x1b2\ngithub.jparrowsec.cn/pingcap/tidb/util/chunk.MutRow.SetDatum(0xc0023f8190, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/chunk/mutrow.go:287 +0x750\ngithub.jparrowsec.cn/pingcap/tidb/util/chunk.MutRow.SetDatums(0xc0023f8190, 0x0, 0xc00166ac60, 0x4, 0x4)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/chunk/mutrow.go:281 +0x14b\ngithub.jparrowsec.cn/pingcap/tidb/table/tables.(*partitionedTable).locateRangePartition(0xc002b9fe40, 0x404ec80, 0xc003a2c200, 0xc002a97b80, 0xc00166ac60, 0x4, 0x4, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/table/tables/partition.go:919 +0x4cc\ngithub.jparrowsec.cn/pingcap/tidb/table/tables.(*partitionedTable).locatePartition(0xc002b9fe40, 0x404ec80, 0xc003a2c200, 0xc002a97b80, 0xc00166ac60, 0x4, 0x4, 0x0, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/table/tables/partition.go:836 +0x9a\ngithub.jparrowsec.cn/pingcap/tidb/table/tables.(*partitionedTable).GetPartitionByRow(0xc002b9fe40, 0x404ec80, 0xc003a2c200, 0xc00166ac60, 0x4, 0x4, 0x4, 0x4, 0xc004af9800, 0x30)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/table/tables/partition.go:1009 +0x8d\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*SelectLockExec).Next(0xc0047a8bb0, 0x3ff6060, 0xc004af9800, 0xc001c8bf40, 0x3835340, 0x5f82ce0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:930 +0x460\ngithub.jparrowsec.cn/pingcap/tidb/executor.Next(0x3ff6060, 0xc004af9800, 0x3ffe5e0, 0xc0047a8bb0, 0xc001c8bf40, 0x0, 0x0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:277 +0x225\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*projectionInputFetcher).run(0xc003549ca0, 0x3ff6060, 0xc004af95f0)\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:373 +0x283\ncreated by github.com/pingcap/tidb/executor.(*ProjectionExec).prepare\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:265 +0x753\n"]
[2021/04/19 07:08:14.863 +00:00] [WARN] [session.go:1428] ["run statement failed"] [conn=347] [schemaVersion=500] [error="runtime error: index out of range [3] with length 3"] [session="{\n "currDBName": "zy",\n "id": 347,\n "status": 3,\n "strictMode": true,\n "txn": "424362923273748486",\n "user": {\n "Username": "root",\n "Hostname": "127.0.0.1",\n "CurrentUser": false,\n "AuthUsername": "root",\n "AuthHostname": "%"\n }\n}"]
[2021/04/19 07:08:14.864 +00:00] [INFO] [conn.go:812] ["command dispatched failed"] [conn=347] [connInfo="id:347, addr:127.0.0.1:35558 status:11, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:1, autocommit:1"] [sql="select * from t1 left join t2 on t1.c_int = t2.c_int for update"] [txn_mode=PESSIMISTIC] [err="runtime error: index out of range [3] with length 3\ngithub.jparrowsec.cn/pingcap/tidb/executor.recoveryProjection\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:445\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*projectionInputFetcher).run.func1\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:349\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:679\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:75\ngithub.jparrowsec.cn/pingcap/tidb/util/chunk.MutRow.SetDatum\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/chunk/mutrow.go:287\ngithub.jparrowsec.cn/pingcap/tidb/util/chunk.MutRow.SetDatums\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/util/chunk/mutrow.go:281\ngithub.jparrowsec.cn/pingcap/tidb/table/tables.(*partitionedTable).locateRangePartition\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/table/tables/partition.go:919\ngithub.jparrowsec.cn/pingcap/tidb/table/tables.(*partitionedTable).locatePartition\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/table/tables/partition.go:836\ngithub.jparrowsec.cn/pingcap/tidb/table/tables.(*partitionedTable).GetPartitionByRow\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/table/tables/partition.go:1009\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*SelectLockExec).Next\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:930\ngithub.jparrowsec.cn/pingcap/tidb/executor.Next\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/executor.go:277\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*projectionInputFetcher).run\n\t/home/jenkins/agent/workspace/optimization-build-tidb-linux-amd/go/src/github.com/pingcap/tidb/executor/projection.go:373\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1357"]
4. What is your TiDB version? (Required)
Release Version: v5.0.0
Edition: Community
Git Commit Hash: bdac088
Git Branch: heads/refs/tags/v5.0.0
UTC Build Time: 2021-04-06 16:36:29
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
The text was updated successfully, but these errors were encountered: