Skip to content

api,pd-ctl: support endKey in ScanRegions http interface #4400

@IcePigZDB

Description

@IcePigZDB

Development Task

Tracking Issue: pingcap/tidb/pull/28330

Support endKey in http interface regions/key and adjust the pdctl region command region startKey to region keysaccordingly. This is originally proposed as a precondition of the push down optimisation of infomation_schema.tikv_region_status.

Previous code is involved in v5.4.0.
In the current implementation of scanRegions , the default limit is defaultRegionLimit(16) without endkey and noRegionLimit(-1) with endkey.

Use this command to query all Regions in a given range [startkey, endkey). It supports range without endKey, the default value of limit is 16 without endKey and -1 (no limit) with endKey.

  • When one try to use startKey = a, endKey = "" try to get all regions in [a, ), the default limit is defaultRegionLimit(16), need to set limit = -1 to get all regions, this is inconsistent with the case where endKey is not empty.
  • No default limit when using pd-ctl to query endKey may cause a lot of network IO cost.

For these two reasons, tend to set the default limit with endKey to defaultRegionLimit(16) the same as without endKey. One can set limit = -1 to get all regions.

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