Skip to content

DATA RACE when running reorg job #40970

Closed
@lcwangchao

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

run sysbench prepare with tidb-server enable race

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

no error

3. What did you see instead (Required)

WARNING: DATA RACE
Write at 0x00c002878400 by goroutine 116044:
  github.com/pingcap/tidb/ddl/ingest.(*diskRootImpl).UpdateUsageAndQuota()
      /root/wangchao/tidb/ddl/ingest/disk_root.go:62 +0x7d
  github.com/pingcap/tidb/ddl/ingest.(*BackendContext).Flush()
      /root/wangchao/tidb/ddl/ingest/backend.go:86 +0xac
  github.com/pingcap/tidb/ddl.(*ddlCtx).writePhysicalTableRecord()
      /root/wangchao/tidb/ddl/backfilling.go:1003 +0xd1c
  github.com/pingcap/tidb/ddl.(*worker).addPhysicalTableIndex()
      /root/wangchao/tidb/ddl/index.go:1720 +0x574
  github.com/pingcap/tidb/ddl.(*worker).addTableIndex()
      /root/wangchao/tidb/ddl/index.go:1755 +0x346
  github.com/pingcap/tidb/ddl.runReorgJobAndHandleErr.func1()
      /root/wangchao/tidb/ddl/index.go:928 +0x131
  github.com/pingcap/tidb/ddl.(*worker).runReorgJob.func1()
      /root/wangchao/tidb/ddl/reorg.go:211 +0x92

Previous write at 0x00c002878400 by goroutine 115893:
  github.com/pingcap/tidb/ddl/ingest.(*diskRootImpl).UpdateUsageAndQuota()
      /root/wangchao/tidb/ddl/ingest/disk_root.go:62 +0x7d
  github.com/pingcap/tidb/ddl/ingest.(*BackendContext).Flush()
      /root/wangchao/tidb/ddl/ingest/backend.go:86 +0xac
  github.com/pingcap/tidb/ddl.(*ddlCtx).writePhysicalTableRecord()
      /root/wangchao/tidb/ddl/backfilling.go:1003 +0xd1c
  github.com/pingcap/tidb/ddl.(*worker).addPhysicalTableIndex()
      /root/wangchao/tidb/ddl/index.go:1720 +0x574
  github.com/pingcap/tidb/ddl.(*worker).addTableIndex()
      /root/wangchao/tidb/ddl/index.go:1755 +0x346
  github.com/pingcap/tidb/ddl.runReorgJobAndHandleErr.func1()
      /root/wangchao/tidb/ddl/index.go:928 +0x131
  github.com/pingcap/tidb/ddl.(*worker).runReorgJob.func1()
      /root/wangchao/tidb/ddl/reorg.go:211 +0x92

Goroutine 116044 (running) created at:
  github.com/pingcap/tidb/ddl.(*worker).runReorgJob()
      /root/wangchao/tidb/ddl/reorg.go:209 +0x579
  github.com/pingcap/tidb/ddl.runReorgJobAndHandleErr()
      /root/wangchao/tidb/ddl/index.go:923 +0x687
  github.com/pingcap/tidb/ddl.doReorgWorkForCreateIndex()
      /root/wangchao/tidb/ddl/index.go:830 +0xef6
  github.com/pingcap/tidb/ddl.(*worker).onCreateIndex()
      /root/wangchao/tidb/ddl/index.go:670 +0x11ad
  github.com/pingcap/tidb/ddl.(*worker).runDDLJob()
      /root/wangchao/tidb/ddl/ddl_worker.go:1011 +0x7b5
  github.com/pingcap/tidb/ddl.(*worker).HandleDDLJobTable()
      /root/wangchao/tidb/ddl/ddl_worker.go:763 +0x5bc
  github.com/pingcap/tidb/ddl.(*ddl).delivery2worker.func1()
      /root/wangchao/tidb/ddl/job_table.go:271 +0xb45
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()
      /root/wangchao/tidb/util/wait_group_wrapper.go:154 +0x73

Goroutine 115893 (running) created at:
  github.com/pingcap/tidb/ddl.(*worker).runReorgJob()
      /root/wangchao/tidb/ddl/reorg.go:209 +0x579
  github.com/pingcap/tidb/ddl.runReorgJobAndHandleErr()
      /root/wangchao/tidb/ddl/index.go:923 +0x687
  github.com/pingcap/tidb/ddl.doReorgWorkForCreateIndex()
      /root/wangchao/tidb/ddl/index.go:830 +0xef6
  github.com/pingcap/tidb/ddl.(*worker).onCreateIndex()
      /root/wangchao/tidb/ddl/index.go:670 +0x11ad
  github.com/pingcap/tidb/ddl.(*worker).runDDLJob()
      /root/wangchao/tidb/ddl/ddl_worker.go:1011 +0x7b5
  github.com/pingcap/tidb/ddl.(*worker).HandleDDLJobTable()
      /root/wangchao/tidb/ddl/ddl_worker.go:763 +0x5bc
  github.com/pingcap/tidb/ddl.(*ddl).delivery2worker.func1()
      /root/wangchao/tidb/ddl/job_table.go:271 +0xb45
  github.com/pingcap/tidb/util.(*WaitGroupWrapper).Run.func1()
      /root/wangchao/tidb/util/wait_group_wrapper.go:154 +0x73
==================

4. What is your TiDB version? (Required)

MySQL [(none)]> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                     |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v6.6.0-alpha-275-g76153ab-dirty
Edition: Community
Git Commit Hash: 76153ab9ffe155bcddf84b3fde6d831782bf04b3
Git Branch: HEAD
UTC Build Time: 2023-02-02 03:20:42
GoVersion: go1.19.1
Race Enabled: true
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions