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.99k stars 5.82k forks source link

flaky test TestDoImport #56413

Open D3Hunter opened 2 hours ago

D3Hunter commented 2 hours ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

=== RUN   TestDoImport
    local_test.go:2086: 
            Error Trace:    pkg/lightning/backend/local/local_test.go:2086
            Error:          "[{{0xc001994000 <nil>} { <nil>}} {{<nil> <nil>} {ingested <nil>}}]" should have 0 item(s), but has 2
            Test:           TestDoImport
--- FAIL: TestDoImport (1.00s)

after we add load balancer, the order of jobs depends on map iteration order, and fatal error job might be run first https://github.com/pingcap/tidb/blob/4df3389c263d5acd1c19155f280eb015b757cd76/pkg/lightning/backend/local/region_job.go#L1170-L1172

add a sleep before runSendToWorker will reproduce it easily https://github.com/pingcap/tidb/blob/4df3389c263d5acd1c19155f280eb015b757cd76/pkg/lightning/backend/local/region_job.go#L1088-L1089

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master

fishiu commented 2 hours ago

/assign