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

data race in TestTableLocksLostCommit when info schema v2 #54651

Closed
Tracked by #41316
D3Hunter opened this issue Jul 16, 2024 · 2 comments
Closed
Tracked by #41316

data race in TestTableLocksLostCommit when info schema v2 #54651

D3Hunter opened this issue Jul 16, 2024 · 2 comments
Labels
component/ddl This issue is related to DDL of TiDB. component/test feature/developing the related feature is in development type/bug The issue is confirmed as a bug.

Comments

@D3Hunter
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

==================
WARNING: DATA RACE
Read at 0x00c027e7cdc8 by goroutine 26853:
  reflect.Value.Pointer()
      /usr/local/go/src/reflect/value.go:2182 +0x208
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/internal/sizer.go:47 +0x97c
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/internal/sizer.go:64 +0xd7c
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/internal/sizer.go:93 +0x8c0
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/internal/sizer.go:141 +0x4cc
  github.com/pingcap/tidb/pkg/infoschema/internal.sizeOf()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/internal/sizer.go:64 +0xd7c
  github.com/pingcap/tidb/pkg/infoschema/internal.Sizeof()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/internal/sizer.go:28 +0x124
  github.com/pingcap/tidb/pkg/infoschema.(*entry[go.shape.struct { github.com/pingcap/tidb/pkg/infoschema.tableID int64; github.com/pingcap/tidb/pkg/infoschema.schemaVersion int64 },go.shape.interface { AddRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, []github.com/pingcap/tidb/pkg/types.Datum, ...github.com/pingcap/tidb/pkg/table.AddRecordOption) (github.com/pingcap/tidb/pkg/kv.Handle, error); Allocators(github.com/pingcap/tidb/pkg/table/context.AllocatorContext) github.com/pingcap/tidb/pkg/meta/autoid.Allocators; Cols() []*github.com/pingcap/tidb/pkg/table.Column; DeletableCols() []*github.com/pingcap/tidb/pkg/table.Column; FullHiddenColsAndVisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; GetPartitionedTable() github.com/pingcap/tidb/pkg/table.PartitionedTable; HiddenCols() []*github.com/pingcap/tidb/pkg/table.Column; IndexPrefix() github.com/pingcap/tidb/pkg/kv.Key; Indices() []github.com/pingcap/tidb/pkg/table.Index; Meta() *github.com/pingcap/tidb/pkg/parser/model.TableInfo; RecordPrefix() github.com/pingcap/tidb/pkg/kv.Key; RemoveRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum) error; Type() github.com/pingcap/tidb/pkg/table.Type; UpdateRecord(context.Context, github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum, []github.com/pingcap/tidb/pkg/types.Datum, []bool) error; VisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; WritableCols() []*github.com/pingcap/tidb/pkg/table.Column }]).Size()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/sieve.go:36 +0x7c
  github.com/pingcap/tidb/pkg/infoschema.(*Sieve[go.shape.struct { github.com/pingcap/tidb/pkg/infoschema.tableID int64; github.com/pingcap/tidb/pkg/infoschema.schemaVersion int64 },go.shape.interface { AddRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, []github.com/pingcap/tidb/pkg/types.Datum, ...github.com/pingcap/tidb/pkg/table.AddRecordOption) (github.com/pingcap/tidb/pkg/kv.Handle, error); Allocators(github.com/pingcap/tidb/pkg/table/context.AllocatorContext) github.com/pingcap/tidb/pkg/meta/autoid.Allocators; Cols() []*github.com/pingcap/tidb/pkg/table.Column; DeletableCols() []*github.com/pingcap/tidb/pkg/table.Column; FullHiddenColsAndVisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; GetPartitionedTable() github.com/pingcap/tidb/pkg/table.PartitionedTable; HiddenCols() []*github.com/pingcap/tidb/pkg/table.Column; IndexPrefix() github.com/pingcap/tidb/pkg/kv.Key; Indices() []github.com/pingcap/tidb/pkg/table.Index; Meta() *github.com/pingcap/tidb/pkg/parser/model.TableInfo; RecordPrefix() github.com/pingcap/tidb/pkg/kv.Key; RemoveRecord(github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum) error; Type() github.com/pingcap/tidb/pkg/table.Type; UpdateRecord(context.Context, github.com/pingcap/tidb/pkg/table/context.MutateContext, github.com/pingcap/tidb/pkg/kv.Handle, []github.com/pingcap/tidb/pkg/types.Datum, []github.com/pingcap/tidb/pkg/types.Datum, []bool) error; VisibleCols() []*github.com/pingcap/tidb/pkg/table.Column; WritableCols() []*github.com/pingcap/tidb/pkg/table.Column }]).Set()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/sieve.go:145 +0x434
  github.com/pingcap/tidb/pkg/infoschema.(*infoschemaV2).tableByID()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/infoschema_v2.go:423 +0x6f8
  github.com/pingcap/tidb/pkg/infoschema.(*infoschemaV2).TableByID()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/infoschema_v2.go:389 +0x58
  github.com/pingcap/tidb/pkg/infoschema.FindTableByTblOrPartID()
      /Users/jujiajia/code/pingcap/tidb/pkg/infoschema/infoschema.go:877 +0x58
  github.com/pingcap/tidb/pkg/planner/core.getTblInfoForUsedStatsByPhysicalID()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/stats.go:125 +0x11c
  github.com/pingcap/tidb/pkg/planner/core.(*DataSource).initStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/stats.go:159 +0x5e8
  github.com/pingcap/tidb/pkg/planner/core.(*DataSource).DeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/stats.go:370 +0x10c
  github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:188 +0x4d4
  github.com/pingcap/tidb/pkg/planner/core.(*DataSource).RecursiveDeriveStats()
      <autogenerated>:1 +0x7c
  github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x248
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalAggregation).RecursiveDeriveStats()
      <autogenerated>:1 +0x7c
  github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x248
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalProjection).RecursiveDeriveStats()
      <autogenerated>:1 +0x7c
  github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x248
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalUnionAll).RecursiveDeriveStats()
      <autogenerated>:1 +0x7c
  github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x248
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalAggregation).RecursiveDeriveStats()
      <autogenerated>:1 +0x7c
  github.com/pingcap/tidb/pkg/planner/core/operator/logicalop.(*BaseLogicalPlan).RecursiveDeriveStats()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/operator/logicalop/base_logical_plan.go:181 +0x248
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalProjection).RecursiveDeriveStats()
      <autogenerated>:1 +0x7c
  github.com/pingcap/tidb/pkg/planner/core.physicalOptimize()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/optimizer.go:1046 +0x228
  github.com/pingcap/tidb/pkg/planner/core.doOptimize()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/optimizer.go:308 +0x338
  github.com/pingcap/tidb/pkg/planner/core.DoOptimize()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/core/optimizer.go:355 +0x210
  github.com/pingcap/tidb/pkg/planner.optimize()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/optimize.go:525 +0x1048
  github.com/pingcap/tidb/pkg/planner.Optimize()
      /Users/jujiajia/code/pingcap/tidb/pkg/planner/optimize.go:356 +0x1e94
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/compiler.go:99 +0xb08
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2098 +0x1310
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:1523 +0x590
  github.com/pingcap/tidb/pkg/ddl.queryDeleteRangeCnt()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/sanity_check.go:65 +0x3c0
  github.com/pingcap/tidb/pkg/ddl.(*ddl).checkDeleteRangeCnt()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/sanity_check.go:36 +0x7c
  github.com/pingcap/tidb/pkg/ddl.(*ddl).checkHistoryJobInTest()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/sanity_check.go:197 +0x68
  github.com/pingcap/tidb/pkg/ddl.(*ddl).doDDLJobWrapper()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/ddl.go:1314 +0x2100
  github.com/pingcap/tidb/pkg/ddl.(*ddl).DoDDLJob()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/ddl.go:1174 +0x204
  github.com/pingcap/tidb/pkg/ddl.(*ddl).dropTableObject()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/ddl_api.go:7155 +0x1c30
  github.com/pingcap/tidb/pkg/ddl.(*ddl).DropTable()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/ddl_api.go:7189 +0xc8
  github.com/pingcap/tidb/pkg/executor.(*DDLExec).executeDropTable()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/ddl.go:350 +0xe8
  github.com/pingcap/tidb/pkg/executor.(*DDLExec).Next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/ddl.go:171 +0xa00
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/internal/exec/executor.go:410 +0x5c8
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:1242 +0x9c
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelayExecutor()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:991 +0x660
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelay()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:825 +0x4dc
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).Exec()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:589 +0x16a4
  github.com/pingcap/tidb/pkg/session.runStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2289 +0x85c
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2150 +0x20d8
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:385 +0xa78
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:157 +0xa8
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:152 +0x1a0
  github.com/pingcap/tidb/pkg/ddl_test.TestTableLocksLostCommit()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/db_table_test.go:476 +0x41c
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func597()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/sysvar.go:3148 +0x88
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).Validate()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/variable.go:305 +0x234
  github.com/pingcap/tidb/pkg/session.(*session).SetGlobalSysVar()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:1336 +0xc8
  github.com/pingcap/tidb/pkg/executor.(*SetExecutor).setSysVariable()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/set.go:155 +0x814
  github.com/pingcap/tidb/pkg/executor.(*SetExecutor).Next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/set.go:105 +0xf38
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/internal/exec/executor.go:410 +0x5c8
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:1242 +0x9c
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelayExecutor()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:991 +0x660
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelay()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:825 +0x4dc
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).Exec()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:589 +0x16a4
  github.com/pingcap/tidb/pkg/session.runStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2289 +0x85c
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2150 +0x20d8
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:385 +0xa78
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:157 +0xa8
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:152 +0x1a0
  github.com/pingcap/tidb/pkg/testkit.(*TestKit).RefreshSession()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:124 +0x2b4
  github.com/pingcap/tidb/pkg/testkit.NewTestKit()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/testkit.go:84 +0x428
  github.com/pingcap/tidb/pkg/ddl_test.TestTableLocksLostCommit()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/db_table_test.go:461 +0xdc
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func598()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/sysvar.go:3156 +0x80
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/sysvar_cache.go:146 +0x86c
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func597()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/sysvar.go:3148 +0x88
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/variable.go:365 +0x2fc
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/sysvar_cache.go:145 +0x7cc
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadSysVarCacheLoop()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/domain.go:1816 +0x90
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3477 +0xc64
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func598()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/sysvar.go:3156 +0x80
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/sysvar_cache.go:146 +0x86c
  github.com/pingcap/tidb/pkg/sessionctx/variable.glob..func597()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/sysvar.go:3148 +0x88
  github.com/pingcap/tidb/pkg/sessionctx/variable.(*SysVar).ValidateWithRelaxedValidation()
      /Users/jujiajia/code/pingcap/tidb/pkg/sessionctx/variable/variable.go:365 +0x2fc
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCache()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/sysvar_cache.go:145 +0x7cc
  github.com/pingcap/tidb/pkg/domain.(*Domain).rebuildSysVarCacheIfNeeded()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/sysvar_cache.go:50 +0x17c
  github.com/pingcap/tidb/pkg/domain.(*Domain).GetSessionCache()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/sysvar_cache.go:61 +0x40
  github.com/pingcap/tidb/pkg/session.(*session).loadCommonGlobalVariablesIfNeeded()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3849 +0x304
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2012 +0x278
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:1523 +0x590
  github.com/pingcap/tidb/pkg/domain.(*Domain).LoadPrivilegeLoop()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/domain.go:1759 +0x16c
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3470 +0xbc8
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3369 +0x68
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/mockstore.go:254 +0x74
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/mockstore.go:225 +0x160
  github.com/pingcap/tidb/pkg/testkit.CreateMockStore()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/mockstore.go:70 +0x524
  github.com/pingcap/tidb/pkg/ddl_test.TestTableLocksLostCommit()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/db_table_test.go:459 +0x64
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x29c
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x50

Previous write at 0x00c027e7cdc8 by goroutine 29244:
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).WritableConstraint.func1()
      /Users/jujiajia/code/pingcap/tidb/pkg/table/tables/tables.go:410 +0xa0
  sync.(*Once).doSlow()
      /usr/local/go/src/sync/once.go:74 +0x100
  sync.(*Once).Do()
      /usr/local/go/src/sync/once.go:65 +0x5c
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).WritableConstraint()
      /Users/jujiajia/code/pingcap/tidb/pkg/table/tables/tables.go:408 +0x100
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).CheckRowConstraint()
      /Users/jujiajia/code/pingcap/tidb/pkg/table/tables/tables.go:427 +0x74
  github.com/pingcap/tidb/pkg/table/tables.(*TableCommon).AddRecord()
      /Users/jujiajia/code/pingcap/tidb/pkg/table/tables/tables.go:965 +0x1f54
  github.com/pingcap/tidb/pkg/executor.(*InsertValues).addRecordWithAutoIDHint()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/insert_common.go:1422 +0x474
  github.com/pingcap/tidb/pkg/executor.(*InsertValues).addRecord()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/insert_common.go:1409 +0x88
  github.com/pingcap/tidb/pkg/executor.(*InsertValues).addRecord-fm()
      <autogenerated>:1 +0x8c
  github.com/pingcap/tidb/pkg/executor.(*InsertValues).batchCheckAndInsert()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/insert_common.go:1310 +0x16d0
  github.com/pingcap/tidb/pkg/executor.(*InsertExec).exec()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/insert.go:96 +0x930
  github.com/pingcap/tidb/pkg/executor.insertRowsFromSelect()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/insert_common.go:512 +0x614
  github.com/pingcap/tidb/pkg/executor.(*InsertExec).Next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/insert.go:305 +0x1e4
  github.com/pingcap/tidb/pkg/executor/internal/exec.Next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/internal/exec/executor.go:410 +0x5c8
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).next()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:1242 +0x9c
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelayExecutor()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:991 +0x660
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).handleNoDelay()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:825 +0x4dc
  github.com/pingcap/tidb/pkg/executor.(*ExecStmt).Exec()
      /Users/jujiajia/code/pingcap/tidb/pkg/executor/adapter.go:589 +0x16a4
  github.com/pingcap/tidb/pkg/session.runStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2289 +0x85c
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:2150 +0x20d8
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteInternal()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:1523 +0x590
  github.com/pingcap/tidb/pkg/ddl/util.CompleteDeleteRange()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/util/util.go:144 +0x370
  github.com/pingcap/tidb/pkg/ddl.(*delRange).doTask()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/delete_range.go:254 +0x478
  github.com/pingcap/tidb/pkg/ddl.(*delRange).doDelRangeWork()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/delete_range.go:202 +0x790
  github.com/pingcap/tidb/pkg/ddl.(*delRange).startEmulator()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/delete_range.go:180 +0x234
  github.com/pingcap/tidb/pkg/ddl.(*delRange).start.func1()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/delete_range.go:156 +0x3c

Goroutine 26853 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1648 +0x95c
  testing.runTests.func1()
      /usr/local/go/src/testing/testing.go:2054 +0xfc
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x29c
  testing.runTests()
      /usr/local/go/src/testing/testing.go:2052 +0x66c
  testing.(*M).Run()
      /usr/local/go/src/testing/testing.go:1925 +0x106c
  go.uber.org/goleak.VerifyTestMain()
      /Users/jujiajia/go/pkg/mod/go.uber.org/[email protected]/testmain.go:53 +0x50
  github.com/pingcap/tidb/pkg/ddl_test.TestMain()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/main_test.go:74 +0x7d4
  main.main()
      _testmain.go:903 +0x140

Goroutine 29244 (running) created at:
  github.com/pingcap/tidb/pkg/ddl.(*delRange).start()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/delete_range.go:156 +0xf8
  github.com/pingcap/tidb/pkg/ddl.(*ddl).newDeleteRangeManager()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/ddl.go:811 +0x278
  github.com/pingcap/tidb/pkg/ddl.(*ddl).Start()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/ddl.go:852 +0x4d8
  github.com/pingcap/tidb/pkg/domain.(*Domain).Init()
      /Users/jujiajia/code/pingcap/tidb/pkg/domain/domain.go:1342 +0x1950
  github.com/pingcap/tidb/pkg/session.(*domainMap).Get.func1()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/tidb.go:92 +0x618
  github.com/pingcap/tidb/pkg/util.RunWithRetry()
      /Users/jujiajia/code/pingcap/tidb/pkg/util/misc.go:70 +0x68
  github.com/pingcap/tidb/pkg/session.(*domainMap).Get()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/tidb.go:79 +0x380
  github.com/pingcap/tidb/pkg/session.createSessionWithOpt()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3689 +0x78
  github.com/pingcap/tidb/pkg/session.createSession()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3681 +0x60
  github.com/pingcap/tidb/pkg/session.createSessionsImpl()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3666 +0xc4
  github.com/pingcap/tidb/pkg/session.createSessions()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3653 +0x80
  github.com/pingcap/tidb/pkg/session.bootstrapSessionImpl()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3437 +0x714
  github.com/pingcap/tidb/pkg/session.BootstrapSession()
      /Users/jujiajia/code/pingcap/tidb/pkg/session/session.go:3369 +0x68
  github.com/pingcap/tidb/pkg/testkit.bootstrap()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/mockstore.go:254 +0x74
  github.com/pingcap/tidb/pkg/testkit.CreateMockStoreAndDomain()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/mockstore.go:225 +0x160
  github.com/pingcap/tidb/pkg/testkit.CreateMockStore()
      /Users/jujiajia/code/pingcap/tidb/pkg/testkit/mockstore.go:70 +0x524
  github.com/pingcap/tidb/pkg/ddl_test.TestTableLocksLostCommit()
      /Users/jujiajia/code/pingcap/tidb/pkg/ddl/db_table_test.go:459 +0x64
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1595 +0x29c
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1648 +0x50

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master

@D3Hunter D3Hunter added the type/bug The issue is confirmed as a bug. label Jul 16, 2024
@D3Hunter
Copy link
Contributor Author

TestAlterTablePartitionWithPlacementPolicy has this issue too

@jebter jebter added feature/developing the related feature is in development component/ddl This issue is related to DDL of TiDB. labels Jul 16, 2024
@lance6716
Copy link
Contributor

closed by #53798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ddl This issue is related to DDL of TiDB. component/test feature/developing the related feature is in development type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants