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 use prefix index and hint IndexHashJoin,occur error: index out of range #24716

Closed
vivid392845427 opened this issue May 18, 2021 · 1 comment · Fixed by #24568
Closed
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@vivid392845427
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t1 (
c_int int(11) DEFAULT NULL,
c_str varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (c_str(7)) /*T![clustered_index] NONCLUSTERED */
);

CREATE TABLE t2 (
c_int int(11) NOT NULL,
c_str varchar(40) NOT NULL,
PRIMARY KEY (c_int,c_str) /*T![clustered_index] NONCLUSTERED */,
KEY c_str (c_str(2))
);

insert into t1 values(1,'pedantic hellman');
insert into t2 values(11,'objective cohen');

select /*+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str = t2.c_str;

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

query return successful

3. What did you see instead (Required)

query fail:
mysql> select /*+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str = t2.c_str;
ERROR 1105 (HY000): runtime error: index out of range [1] with length 1

log:
[2021/05/18 07:27:16.054 +00:00] [ERROR] [misc.go:90] ["panic in the recoverable goroutine"] [r={}] ["stack trace"="github.com/pingcap/tidb/util.WithRecovery.func1\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:92\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.com/pingcap/tidb/executor.(*innerWorker).constructLookupContent\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:540\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).fetchInnerResults\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:571\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).handleTask\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:600\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:483\ngithub.com/pingcap/tidb/executor.(IndexNestedLoopHashJoin).startWorkers.func2\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:196\ngithub.com/pingcap/tidb/util.WithRecovery\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:95"]
[2021/05/18 07:27:16.054 +00:00] [INFO] [conn.go:812] ["command dispatched failed"] [conn=23] [connInfo="id:23, addr:127.0.0.1:51006 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="select /
+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str = t2.c_str"] [txn_mode=PESSIMISTIC] [err="runtime error: index out of range [1] with length 1\ngithub.com/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).finishJoinWorkers\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:203\ngithub.com/pingcap/tidb/util.WithRecovery.func1\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:87\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.com/pingcap/tidb/executor.(*innerWorker).constructLookupContent\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:540\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).fetchInnerResults\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:571\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).handleTask\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:600\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:483\ngithub.com/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).startWorkers.func2\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:196\ngithub.com/pingcap/tidb/util.WithRecovery\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:95\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1357"]

4. What is your TiDB version? (Required)

Release Version: v5.0.1-3-g41c0f1762
Edition: Community
Git Commit Hash: 41c0f17
Git Branch: release-5.0
UTC Build Time: 2021-05-13 17:21:10
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@vivid392845427 vivid392845427 added the type/bug The issue is confirmed as a bug. label May 18, 2021
@vivid392845427 vivid392845427 changed the title query hint IndexHashJoin,occur error: index out of range query use prefix index and hint IndexHashJoin,occur error: index out of range May 18, 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
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants