Skip to content

BatchScanRegions should check context #10129

@lhy1024

Description

@lhy1024

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]
Image Image

BatchScanRegions should stop scanning on cancellation/deadline and we should reduce log

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions