Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: TiKV中的region是否预先分配好的?如何查看当前所有region大小的分布情况?
【TiDB Usage Environment】Production\Test Environment\POC
【TiDB Version】
【Encountered Problem】
【Reproduction Path】What operations were performed that led to the problem
【Problem Phenomenon and Impact】
You can query the region distribution by performing a join query on tikv_region_status, tikv_store_status, and tikv_region_peers under Information-schema, or use pd-ctl region store xxx to view the regions on certain stores.
When a TiKV cluster starts, there is an initial region with a range of startkey=“” and endkey=“”, which can accommodate all keys. This region continuously splits, similar to cell division, where one becomes two.
In Grafana, there is a regionsize panel where you can see the size statistics of the regions.
Pre-allocation, manual allocation, and automatic allocation are all possible.
Are there any commands to check the allocation status?
How is a Region split?
Regions are not pre-divided, but there is indeed a Region splitting mechanism. When the size of a Region exceeds the value of the parameters region-max-size
or region-max-keys
, splitting is triggered, and the information after the split is reported to PD.
Is the default split size 96MB?
Yes, the logic for Region splitting and scheduling can be referred to in the document link above.
When it reaches 144MB in size, it will split into two.
In the course, some say it splits at 96MB, while others say it splits at 144MB. I’m not sure at what size it actually splits.
That is, region-max-size = 1.5 * region-split-size, by default it starts splitting at 144MB,
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.