BatchScanRegions should check context
Open
type/enhancement
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Enhancement Task
Now, BatchScanRegions ignores ctx and holds RegionTree read lock, which will block heartbeats if it hold lock for long periods.
Under heavy batch-scan traffic, requests can run for 10+ minutes, keeping the read lock and starving writes (CheckAndPutRootTree uses r.t.Lock()). This blocks region heartbeat updates.
```
[2026/01/01 00:22:46.092 +08:00] [WARN] [interceptor.go:197] ["request stats"] ["start time"=2026/01/01 00:11:09.834 +08:00] ["time spent"=11m36.258304292s]
```
BatchScanRegions should stop scanning on cancellation/deadline and we should reduce log
Contributor guide
Assessment
This issue has not been assessed yet.