tikv / pd

Placement driver for TiKV

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `BatchScanRegions` which loads non-continuous regions in one RPC

you06 opened this issue · comments

Development Task

Sometimes, the client need to locate non-continuous key ranges. Current PD has no good solution for this requirement.

There are 2 workaround:

  1. Use GetRegion to load region one by one, check if the ranges are drained eachtime.
  2. Use ScanRegion to load (ranges[0].start, ranges[len(ranges)-1].end), which can cause unexpected traffics (imagine the ranges[0] is the first row and ranges[len(ranges)-1] is the last row of a large table).

Thus a interface BatchScanRegions is required.

It returns multi regions like ScanRegion, but accept a key range slice parameters. The returned regions are guaranteed to cover the given ranges if limitation is not reached.