pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.52k stars 5.74k forks source link

DATA RACE in the TestTableRestoreSuite #53820

Open hawkingrei opened 1 month ago

hawkingrei commented 1 month ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

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

3. What did you see instead (Required)

==================
WARNING: DATA RACE
Read at 0x00c000b4a508 by goroutine 224:
  github.com/pingcap/tidb/pkg/lightning/backend/tidb.(*tidbEncoder).Encode()
      pkg/lightning/backend/tidb/tidb.go:529 +0xcb
  github.com/pingcap/tidb/lightning/pkg/importer.(*chunkProcessor).encodeLoop()
      lightning/pkg/importer/chunk_process.go:458 +0x29a1
  github.com/pingcap/tidb/lightning/pkg/importer.(*chunkProcessor).process()
      lightning/pkg/importer/chunk_process.go:209 +0xbad
  github.com/pingcap/tidb/lightning/pkg/importer.(*TableImporter).preprocessEngine.func3()
      lightning/pkg/importer/table_import.go:792 +0x2c9
  github.com/pingcap/tidb/lightning/pkg/importer.(*TableImporter).preprocessEngine.func5()
      lightning/pkg/importer/table_import.go:824 +0x4f
Previous write at 0x00c000b4a508 by goroutine 221:
  github.com/pingcap/tidb/pkg/lightning/backend/tidb.(*tidbEncoder).Encode()
      pkg/lightning/backend/tidb/tidb.go:543 +0x1178
  github.com/pingcap/tidb/lightning/pkg/importer.(*chunkProcessor).encodeLoop()
      lightning/pkg/importer/chunk_process.go:458 +0x29a1
  github.com/pingcap/tidb/lightning/pkg/importer.(*chunkProcessor).process()
      lightning/pkg/importer/chunk_process.go:209 +0xbad
  github.com/pingcap/tidb/lightning/pkg/importer.(*TableImporter).preprocessEngine.func3()
      lightning/pkg/importer/table_import.go:792 +0x2c9
  github.com/pingcap/tidb/lightning/pkg/importer.(*TableImporter).preprocessEngine.func5()
      lightning/pkg/importer/table_import.go:824 +0x4f
Goroutine 224 (running) created at:
  github.com/pingcap/tidb/lightning/pkg/importer.(*TableImporter).preprocessEngine()
      lightning/pkg/importer/table_import.go:782 +0x1f8d
  github.com/pingcap/tidb/lightning/pkg/importer.(*tableRestoreSuite).TestRestoreEngineFailed()
      lightning/pkg/importer/table_import_test.go:452 +0x25e4
  runtime.call16()
      src/runtime/asm_amd64.s:747 +0x42
  reflect.Value.Call()
      GOROOT/src/reflect/value.go:380 +0xb5
  github.com/stretchr/testify/suite.Run.func1()
      external/com_github_stretchr_testify/suite/suite.go:202 +0x766
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
Goroutine 221 (finished) created at:
  github.com/pingcap/tidb/lightning/pkg/importer.(*TableImporter).preprocessEngine()
      lightning/pkg/importer/table_import.go:782 +0x1f8d
  github.com/pingcap/tidb/lightning/pkg/importer.(*tableRestoreSuite).TestRestoreEngineFailed()
      lightning/pkg/importer/table_import_test.go:452 +0x25e4
  runtime.call16()
      src/runtime/asm_amd64.s:747 +0x42
  reflect.Value.Call()
      GOROOT/src/reflect/value.go:380 +0xb5
  github.com/stretchr/testify/suite.Run.func1()
      external/com_github_stretchr_testify/suite/suite.go:202 +0x766
  testing.tRunner()
      GOROOT/src/testing/testing.go:1595 +0x261
  testing.(*T).Run.func1()
      GOROOT/src/testing/testing.go:1648 +0x44
================== 

4. What is your TiDB version? (Required)

lance6716 commented 1 month ago

/assign @lyzx2001