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

big unsigned bigint primary key point-select with plan cache enable error #10111

Closed
lysu opened this issue Apr 10, 2019 · 4 comments · Fixed by #17090
Closed

big unsigned bigint primary key point-select with plan cache enable error #10111

lysu opened this issue Apr 10, 2019 · 4 comments · Fixed by #17090
Assignees
Labels
epic/plan-cache sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@lysu
Copy link
Contributor

lysu commented Apr 10, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.

enable plan cache

create table t(a bigint unsigned primary key, b int, c int, key idx_bc(b,c));
insert into t (a, b, c) values (18446744073709551615, 4, 4);
set @p1=18446744073709551615;
set @p2=1;
prepare stmt7 from "select a from t where a = ?";
execute stmt7 using @p2; // fill plan cache
execute stmt7 using @p1;
  1. What did you expect to see?

got 18446744073709551615, 4, 4 row

  1. What did you see instead?
...     "[types:1690]BIGINT value is out of range in '18446744073709551615'\n" +
...     "github.com/pingcap/errors.AddStack\n" +
...     "\t/home/robi/Code/go/pkg/mod/github.com/pingcap/errors@v0.11.1/errors.go:174\n" +
...     "github.com/pingcap/parser/terror.(*Error).GenWithStackByArgs\n" +
...     "\t/home/robi/Code/go/pkg/mod/github.com/pingcap/parser@v0.0.0-20190408064140-cdceeb2c5476/terror/terror.go:233\n" +
...     "github.com/pingcap/tidb/types.StrToInt\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/types/convert.go:182\n" +
...     "github.com/pingcap/tidb/types.(*Datum).toSignedInteger\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/types/datum.go:1432\n" +
...     "github.com/pingcap/tidb/types.(*Datum).ToInt64\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/types/datum.go:1416\n" +
...     "github.com/pingcap/tidb/planner/core.(*Execute).rebuildRange\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/planner/core/common_plans.go:257\n" +
...     "github.com/pingcap/tidb/planner/core.(*Execute).getPhysicalPlan\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/planner/core/common_plans.go:205\n" +
...     "github.com/pingcap/tidb/planner/core.(*Execute).OptimizePreparedPlan\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/planner/core/common_plans.go:187\n" +
...     "github.com/pingcap/tidb/planner.Optimize\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/planner/optimize.go:55\n" +
...     "github.com/pingcap/tidb/executor.(*Compiler).Compile\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/executor/compiler.go:49\n" +
...     "github.com/pingcap/tidb/session.(*session).execute\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/session/session.go:969\n" +
...     "github.com/pingcap/tidb/session.(*session).Execute\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/session/session.go:930\n" +
...     "github.com/pingcap/tidb/util/testkit.(*TestKit).Exec\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:137\n" +
...     "github.com/pingcap/tidb/util/testkit.(*TestKit).MustQuery\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:182\n" +
...     "github.com/pingcap/tidb/planner/core_test.(*testPointGetSuite).TestPointGetPlanCache\n" +
...     "\t/home/robi/Code/go/src/github.com/pingcap/tidb/planner/core/point_get_plan_test.go:146\n" +
...     "reflect.Value.call\n" +
...     "\t/home/robi/go1.12/src/reflect/value.go:447\n" +
...     "reflect.Value.Call\n" +
...     "\t/home/robi/go1.12/src/reflect/value.go:308\n" +
...     "github.com/pingcap/check.(*suiteRunner).forkTest.func1\n" +
...     "\t/home/robi/Code/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:836\n" +
...     "github.com/pingcap/check.(*suiteRunner).forkCall.func1\n" +
...     "\t/home/robi/Code/go/pkg/mod/github.com/pingcap/check@v0.0.0-20190102082844-67f458068fc8/check.go:730\n" +
...     "runtime.goexit\n" +
...     "\t/home/robi/go1.12/src/runtime/asm_amd64.s:1337"
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v3.0.0-beta.1-84-g7acbe520f-dirty
Git Commit Hash: 7acbe520f48f64dadce31e52532574ba059de801
Git Branch: master
UTC Build Time: 2019-04-10 12:55:52
GoVersion: go version go1.12 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
@lysu lysu added the type/bug The issue is confirmed as a bug. label Apr 10, 2019
@lysu lysu self-assigned this Apr 10, 2019
@lysu
Copy link
Contributor Author

lysu commented Apr 10, 2019

this question is caused by our plan cache using string datum and lost unsigned type info.

@lysu lysu changed the title big unsigned bigint primary key with plan cache enable error big unsigned bigint primary key point-select with plan cache enable error Apr 10, 2019
@zz-jason zz-jason added the sig/planner SIG: Planner label Mar 16, 2020
@zz-jason
Copy link
Member

@lysu any update? @eurekaka is fixing plan cache issues, maybe he can help you.

@lysu
Copy link
Contributor Author

lysu commented Mar 18, 2020

no, it is too hard to fix this(fix one side but make another side wrong- -) before we support "full-type-handle" and at last year we say we have a plan to support "full-type-handle", so I give up at that time- -

@ChenPeng2013
Copy link
Contributor

verified on
master: v4.0.0-beta.2-501-g5d0159043
release-4.0: v4.0.0-rc.2-31-gffaae4f7f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/plan-cache 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.

4 participants