Skip to content

some inTest assert panic comes from ddl/systable/min_job_id when testing #54868

@AilinKid

Description

@AilinKid

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

panic: assert failed, location mismatch, ctxLoc: Local, varsLoc: Local, stmtLoc: Local [recovered]
	panic: assert failed, location mismatch, ctxLoc: Local, varsLoc: Local, stmtLoc: Local

goroutine 1993 [running]:
github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile.func1()
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/compiler.go:57 +0x360
panic({0x104246040?, 0x1400a1476f0?})
	/opt/homebrew/opt/go/libexec/src/runtime/panic.go:914 +0x218
github.com/pingcap/tidb/pkg/util/intest.doPanic(...)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/util/intest/assert.go:59
github.com/pingcap/tidb/pkg/util/intest.Assert(...)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/util/intest/assert.go:27
github.com/pingcap/tidb/pkg/expression/context.AssertLocationWithSessionVars(0x1046baa00?, 0x1400ae80000)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/context/context.go:232 +0x1c8
github.com/pingcap/tidb/pkg/expression/contextsession.(*SessionEvalContext).TypeCtx(0x1400a226240)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/contextsession/sessionctx.go:209 +0xb0
github.com/pingcap/tidb/pkg/expression.typeCtx(...)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/context.go:57
github.com/pingcap/tidb/pkg/expression.(*Constant).Equal(0x1400a17bec0, {0x104bf9788, 0x1400a226240}, {0x104c35ce0?, 0x1400a17bec0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/constant.go:437 +0xa0
github.com/pingcap/tidb/pkg/expression.(*baseBuiltinFunc).equal(0x1400a226480, {0x104bf9788, 0x1400a226240}, {0x104c0fb68?, 0x1400a226480?})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/builtin.go:400 +0xd8
github.com/pingcap/tidb/pkg/expression.(*ScalarFunction).Equal(0x1400a224460, {0x104bf9788, 0x1400a226240}, {0x104c35fb0?, 0x1400a224460})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/scalar_function.go:372 +0xc4
github.com/pingcap/tidb/pkg/planner/cardinality.getMaskAndRanges({0x104bfedc0, 0x1400a147220}, {0x1400a147670, 0x1, 0x1}, 0x0?, {0x0?, 0x104b6e6e8?, 0x14006284fa8?}, 0x10022ce6c?, ...)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/cardinality/selectivity.go:730 +0x3cc
github.com/pingcap/tidb/pkg/planner/cardinality.Selectivity({0x104bfedc0, 0x1400a147220?}, 0x1400a223260, {0x1400a1475d0, 0x1, 0x1}, {0x1400a1472f0, 0x1, 0x104be0f80?})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/cardinality/selectivity.go:130 +0x970
github.com/pingcap/tidb/pkg/planner/core.(*DataSource).deriveStatsByFilter(0x140099d58c0, {0x1400a1475d0, 0x1, 0x1}, {0x1400a1472f0, 0x1, 0x2})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/stats.go:197 +0xe4
github.com/pingcap/tidb/pkg/planner/core.(*DataSource).DeriveStats(0x140099d58c0, {0x140099d58c0?, 0x400a0b2ff0?, 0x1?}, 0x14006285ee8?, {0x10022c584?, 0x1?, 0x1400a162528?}, {0x0?, 0x0?, ...})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/logical_datasource.go:328 +0x45c
github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats(0x140099d58e0, {0x0, 0x0, 0x0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:188 +0x204
github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats(0x1400a0b2ff0, {0x0, 0x0, 0x0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x114
github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats(0x140099c3e20, {0x0, 0x0, 0x0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x114
github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats(0x1400a0b2f20, {0x0, 0x0, 0x0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x114
github.com/pingcap/tidb/pkg/planner/core.physicalOptimize({0x104c321d8, 0x1400a0b2f00}, 0x1400a2168a0)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:1046 +0xdc
github.com/pingcap/tidb/pkg/planner/core.doOptimize({0x104bba9b8, 0x1400a1deb40}, {0x104bfedc0?, 0x1400a147220?}, 0x140062864c8?, {0x104c321d8, 0x1400a0b2f00})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:308 +0xf0
github.com/pingcap/tidb/pkg/planner/core.DoOptimize({0x104bba9b8, 0x1400a1deb40}, {0x104bfedc0, 0x1400a147220}, 0x1400a224380?, {0x104c321d8, 0x1400a0b2f00})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:355 +0xd0
github.com/pingcap/tidb/pkg/planner.optimize({0x104bba9b8, 0x1400a1deb40}, {0x104bfedc0?, 0x1400a147220}, {0x104bc6cf0?, 0x1400a0f8b40?}, {0x104c02388, 0x1400a0d17a0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/optimize.go:525 +0x500
github.com/pingcap/tidb/pkg/planner.Optimize({0x104bba9b8?, 0x1400a1deb40}, {0x104c39b10?, 0x140099ed900}, {0x104bc6cf0, 0x1400a0f8b40}, {0x104c02388?, 0x1400a0d17a0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/optimize.go:356 +0x1178
github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile(0x1400ae93840, {0x104bba9b8?, 0x1400a1deb40?}, {0x104bd1808?, 0x1400a0f8b40})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/compiler.go:99 +0x2c8
github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt(0x140099ed900, {0x104bba9b8?, 0x1400a1deb40?}, {0x104bd1808, 0x1400a0f8b40?})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/session/session.go:2098 +0x650
github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal(0x140099ed900, {0x104bba9b8, 0x1400a1deb40}, {0x1400a22bdc0, 0x3c}, {0x0, 0x0, 0x0})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/session/session.go:1523 +0x17c
github.com/pingcap/tidb/pkg/ddl/session.(*Session).Execute(0x1400a147230, {0x104bba9b8, 0x1400a1deb40}, {0x1400a22bdc0, 0x3c}, {0x103566932, 0xe})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/session/session.go:85 +0x150
github.com/pingcap/tidb/pkg/ddl/systable.(*manager).GetMinJobID.func1(0x1400acbad98?)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/systable/manager.go:120 +0x94
github.com/pingcap/tidb/pkg/ddl/systable.(*manager).withNewSession(0x1400acf2cd0, 0x14001488dd0)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/systable/manager.go:71 +0xc4
github.com/pingcap/tidb/pkg/ddl/systable.(*manager).GetMinJobID(0x1013ca433?, {0x104bba9b8?, 0x1400a1deb40?}, 0x8c?)
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/systable/manager.go:118 +0x58
github.com/pingcap/tidb/pkg/ddl/systable.(*MinJobIDRefresher).refresh(0x10359a57b?, {0x104bba9b8?, 0x1400a1deb40?})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/systable/min_job_id.go:66 +0x48
github.com/pingcap/tidb/pkg/ddl/systable.(*MinJobIDRefresher).Start(0x18?, {0x104bba9b8, 0x1400a1deb40})
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/systable/min_job_id.go:54 +0x38
github.com/pingcap/tidb/pkg/ddl.(*ddl).Start.func3()
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/ddl/ddl.go:869 +0x30
github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run.func1()
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/util/wait_group_wrapper.go:157 +0x58
created by github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).Run in goroutine 47
	/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/util/wait_group_wrapper.go:155 +0x7c

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

no panic

3. What did you see instead (Required)

occasionally panic

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.impact/panicseverity/minortype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions