tidb icon indicating copy to clipboard operation
tidb copied to clipboard

add index can not be canceled timely

Open lance6716 opened this issue 1 year ago • 1 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

func (dc *ddlCtx) handleRangeTasks is executed on a single goroutine. There's a loop that process 1024 (backfillTaskChanSize) tasks. And each task has a network RPC to adjust end key

https://github.com/pingcap/tidb/blob/d7ce2f2faa1da3177a0f0a7e825f6e8fccd13ec8/ddl/backfilling.go#L505-L511

In the log, it costs 6 seconds to finish one loop

[2024/10/12 20:22:01.257 +08:00] [INFO] [backfilling.go:511] ["[ddl] send range task to workers, change end key"] ...
...
[2024/10/12 20:22:06.922 +08:00] [INFO] [backfilling.go:511] ["[ddl] send range task to workers, change end key"] ...

So 6 second * 1024 = 1.7h is needed to finish handleRangeTasks, then the job cancelation can be seen

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

this is an ONCALL, the version I checked is v6.5.4

lance6716 avatar Oct 15 '24 06:10 lance6716

8.5 will be fixed in https://github.com/pingcap/tidb/issues/56017

lance6716 avatar Oct 15 '24 06:10 lance6716

To improve the speed of getRangeEndKey, we can concurrently execute them.

lance6716 avatar Oct 21 '24 09:10 lance6716