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

admin check table fail on partitioned table in 3.0 #15118

Closed
tiancaiamao opened this issue Mar 4, 2020 · 3 comments
Closed

admin check table fail on partitioned table in 3.0 #15118

tiancaiamao opened this issue Mar 4, 2020 · 3 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major type/bug The issue is confirmed as a bug.

Comments

@tiancaiamao
Copy link
Contributor

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.
use test;

create table if not exists forupdate_on_partition (
  age int not null primary key,
  nickname varchar(20) not null,
  gender int not null default 0,
  first_name varchar(30) not null default '',
  last_name varchar(20) not null default '',
  full_name varchar(60) as (concat(first_name, ' ', last_name)),
  index idx_nickname (nickname)
) partition by range (age) (
  partition child values less than (18),
  partition young values less than (30),
  partition middle values less than (50),
  partition old values less than (123)
);

admin check table forupdate_on_partition;
  1. What did you expect to see?

No error

  1. What did you see instead?

The error stack is

[2020/03/04 13:10:40.038 +08:00] [WARN] [conn.go:684] ["dispatch error"] [conn=1] [connInfo="id:1, addr:127.0.0.1:51497 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="admin check table forupdate_on_partition"] [err="strconv.ParseUint: parsing \"\": invalid syntax
github.com/pingcap/errors.AddStack
	C:/project/pkg/mod/github.com/pingcap/errors@v0.11.4/errors.go:174
github.com/pingcap/errors.Trace
	C:/project/pkg/mod/github.com/pingcap/errors@v0.11.4/juju_adaptor.go:15
github.com/pingcap/tidb/planner/core.(*PlanBuilder).rewriteExprNode
	C:/project/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:143
github.com/pingcap/tidb/planner/core.(*PlanBuilder).rewriteWithPreprocess
	C:/project/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:111
github.com/pingcap/tidb/planner/core.(*PlanBuilder).rewrite
	C:/project/src/github.com/pingcap/tidb/planner/core/expression_rewriter.go:86
github.com/pingcap/tidb/planner/core.(*PlanBuilder).projectVirtualColumns
	C:/project/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2468
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildDataSource
	C:/project/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2350
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode
	C:/project/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:155
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildJoin
	C:/project/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:378
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildResultSetNode
	C:/project/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:147
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildSelect
	C:/project/src/github.com/pingcap/tidb/planner/core/logical_plan_builder.go:2018
github.com/pingcap/tidb/planner/core.(*PlanBuilder).Build
	C:/project/src/github.com/pingcap/tidb/planner/core/planbuilder.go:271
github.com/pingcap/tidb/planner.Optimize
	C:/project/src/github.com/pingcap/tidb/planner/optimize.go:39
github.com/pingcap/tidb/executor.(*Compiler).compile
	C:/project/src/github.com/pingcap/tidb/executor/compiler.go:79
github.com/pingcap/tidb/executor.(*Compiler).SkipBindCompile
	C:/project/src/github.com/pingcap/tidb/executor/compiler.go:61
github.com/pingcap/tidb/session.(*session).execute
	C:/project/src/github.com/pingcap/tidb/session/session.go:1074
github.com/pingcap/tidb/session.(*session).Execute
	C:/project/src/github.com/pingcap/tidb/session/session.go:1018
github.com/pingcap/tidb/session.execRestrictedSQL
	C:/project/src/github.com/pingcap/tidb/session/session.go:768
github.com/pingcap/tidb/session.(*session).ExecRestrictedSQLWithSnapshot
	C:/project/src/github.com/pingcap/tidb/session/session.go:763
github.com/pingcap/tidb/util/admin.getCount
	C:/project/src/github.com/pingcap/tidb/util/admin/admin.go:267
github.com/pingcap/tidb/util/admin.CheckIndicesCount
	C:/project/src/github.com/pingcap/tidb/util/admin/admin.go:292
github.com/pingcap/tidb/executor.(*CheckTableExec).Next
	C:/project/src/github.com/pingcap/tidb/executor/executor.go:549
github.com/pingcap/tidb/executor.Next
	C:/project/src/github.com/pingcap/tidb/executor/executor.go:192
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor
	C:/project/src/github.com/pingcap/tidb/executor/adapter.go:435
github.com/pingcap/tidb/executor.(*ExecStmt).Exec
	C:/project/src/github.com/pingcap/tidb/executor/adapter.go:299
github.com/pingcap/tidb/session.runStmt
	C:/project/src/github.com/pingcap/tidb/session/tidb.go:251
github.com/pingcap/tidb/session.(*session).executeStatement
	C:/project/src/github.com/pingcap/tidb/session/session.go:980
github.com/pingcap/tidb/session.(*session).execute
	C:/project/src/github.com/pingcap/tidb/session/session.go:1094
github.com/pingcap/tidb/session.(*session).Execute
	C:/project/src/github.com/pingcap/tidb/session/session.go:1018
github.com/pingcap/tidb/server.(*TiDBContext).Execute
	C:/project/src/github.com/pingcap/tidb/server/driver_tidb.go:246
github.com/pingcap/tidb/server.(*clientConn).handleQuery
	C:/project/src/github.com/pingcap/tidb/server/conn.go:1205
github.com/pingcap/tidb/server.(*clientConn).dispatch
	C:/project/src/github.com/pingcap/tidb/server/conn.go:921"]
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

Current 3.0 branch

commit b93defa381c8de1e509a5c5ecdabdd07ad14e65b (HEAD, origin/release-3.0)
Author: pingcap-github-bot <sre-bot@pingcap.com>
Date:   Tue Mar 3 16:36:41 2020 +0800

    test: fix data race in TestDisableTxnAutoRetry (#14825) (#14856)
@wjhuang2016
Copy link
Member

wjhuang2016 commented Mar 4, 2020

image
image
As we can see from the pictures and the error stack, admin check table would call ExecRestrictedSQLWithSnapshot, it will use a session without MaxAllowedPacket, which lead to parseUint failure.

@wjhuang2016 wjhuang2016 added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 4, 2020
@tiancaiamao tiancaiamao self-assigned this Mar 6, 2020
@tiancaiamao
Copy link
Contributor Author

I'll handle it today

@tiancaiamao
Copy link
Contributor Author

3.0 Fixed in #15114

On the master branch, it's fixed by here https://github.com/pingcap/tidb/pull/14663/files#diff-928cb614ae092ed4c6f349f4c4c991e4R856

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants