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

Unexpected error level log when enabling plan cache #23633

Closed
wjhuang2016 opened this issue Mar 29, 2021 · 2 comments
Closed

Unexpected error level log when enabling plan cache #23633

wjhuang2016 opened this issue Mar 29, 2021 · 2 comments
Assignees
Labels
epic/plan-cache severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

wjhuang2016 commented Mar 29, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Enable plan cache.

CREATE TABLE `tbl_6` (
  `col_26` int(10) unsigned NOT NULL,
  `col_27` varchar(165) DEFAULT NULL,
  `col_28` tinyint(1) NOT NULL,
  `col_29` binary(28) DEFAULT NULL,
  `col_30` datetime NOT NULL,
  `col_31` decimal(61,17) NOT NULL,
  `col_32` bit(41) NOT NULL,
  `col_33` bit(34) DEFAULT b'110001000101001011000101001000011',
  PRIMARY KEY (`col_30`,`col_26`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
prepare prepare_27 from " select   count(*) from tbl_6 where col_31 in ( ? , 'dFlcfUsNghMGlXDZ' ) ";
set @i0 = 'aqhvHYtyVqyVII';
execute prepare_27 using @i0;

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

No error level log.

3. What did you see instead (Required)

[expr_to_pb.go:130] ["encode decimal"] [error="[types:8029]Bad Number"] [errorVerbose="[types:8029]Bad Number\ngithub.com/pingcap/errors.AddStack\n\t/Users/pingcap/gopkg/pkg/mod/github.com/pingcap/[email protected]/errors.go:174\ngithub.com/pingcap/errors.Trace\n\t/Users/pingcap/gopkg/pkg/mod/github.com/pingcap/[email protected]/juju_adaptor.go:15\ngithub.com/pingcap/tidb/util/codec.EncodeDecimal\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/util/codec/decimal.go:33\ngithub.com/pingcap/tidb/expression.(*PbConverter).encodeDatum\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/expression/expr_to_pb.go:128\ngithub.com/pingcap/tidb/expression.PbConverter.conOrCorColToPBExpr\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/expression/expr_to_pb.go:85\ngithub.com/pingcap/tidb/expression.canExprPushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/expression/expression.go:1216\ngithub.com/pingcap/tidb/expression.canScalarFuncPushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/expression/expression.go:1189\ngithub.com/pingcap/tidb/expression.canExprPushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/expression/expression.go:1220\ngithub.com/pingcap/tidb/expression.PushDownExprs\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/expression/expression.go:1229\ngithub.com/pingcap/tidb/planner/core.(*DataSource).PredicatePushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:104\ngithub.com/pingcap/tidb/planner/core.(*LogicalSelection).PredicatePushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:77\ngithub.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:56\ngithub.com/pingcap/tidb/planner/core.(*LogicalAggregation).PredicatePushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:429\ngithub.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:56\ngithub.com/pingcap/tidb/planner/core.(*LogicalProjection).PredicatePushDown\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:379\ngithub.com/pingcap/tidb/planner/core.(*ppdSolver).optimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/rule_predicate_push_down.go:29\ngithub.com/pingcap/tidb/planner/core.logicalOptimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/optimizer.go:198\ngithub.com/pingcap/tidb/planner/core.DoOptimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/optimizer.go:132\ngithub.com/pingcap/tidb/planner.optimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/optimize.go:289\ngithub.com/pingcap/tidb/planner.Optimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/optimize.go:125\ngithub.com/pingcap/tidb/planner/core.(*Execute).getPhysicalPlan\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/common_plans.go:389\ngithub.com/pingcap/tidb/planner/core.(*Execute).OptimizePreparedPlan\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/core/common_plans.go:274\ngithub.com/pingcap/tidb/planner.optimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/optimize.go:270\ngithub.com/pingcap/tidb/planner.Optimize\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/planner/optimize.go:125\ngithub.com/pingcap/tidb/executor.(*Compiler).Compile\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/executor/compiler.go:62\ngithub.com/pingcap/tidb/session.(*session).ExecuteStmt\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/session/session.go:1409\ngithub.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/server/driver_tidb.go:218\ngithub.com/pingcap/tidb/server.(*clientConn).handleStmt\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/server/conn.go:1626\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/server/conn.go:1499\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/server/conn.go:1033\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/server/conn.go:795\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/Users/pingcap/workspace/build-darwin-amd64-4.0/go/src/github.com/pingcap/tidb/server/server.go:480"]

4. What is your TiDB version? (Required)

@wjhuang2016 wjhuang2016 added the type/bug The issue is confirmed as a bug. label Mar 29, 2021
@wjhuang2016 wjhuang2016 changed the title Unexpected error level log Unexpected error level log when enabling plan cache Mar 29, 2021
@qw4990
Copy link
Contributor

qw4990 commented Oct 29, 2021

This error seems handled by builtinCastStringAsDecimalSig.evalDecimal.
And now, the non-prepared query also hides the error:

mysql> select   count(*) from tbl_6 where col_31 in ( 'aqhvHYtyVqyVII' , 'dFlcfUsNghMGlXDZ' );
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set, 2 warnings (0.00 sec)

mysql> show warnings;
+---------+------+------------+
| Level   | Code | Message    |
+---------+------+------------+
| Warning | 8029 | Bad Number |
| Warning | 8029 | Bad Number |
+---------+------+------------+
2 rows in set (0.00 sec)

Since prepared queries have the same behavior with non-prepared queries, I'll close this issue now.

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/plan-cache severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

4 participants