How to clean up empty regions with approximate size 0 and approximate keys 0? These regions did not merge after enabling merge

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 请问approximate size为0、approximate keys也为0的空region怎么清理?开启合并后这些region并没有进行合并

| username: SWCloud

Production environment V5.1.0

After enabling Merge for the cluster, the number of empty regions decreases very slowly. Sampling some empty regions, I found that their approximate size and approximate keys are both 0.
How can these regions be merged, or how can they be cleaned up?


| username: h5n1 | Original post link

  1. Merging is done to the right, meaning the next adjacent region must also meet the merge conditions.
  2. Setting the table region for TiFlash will not perform cross-table merging.
| username: SWCloud | Original post link

TiFlash is not set up.

Previously, I looked up some information and it seems that PD considers regions with approximate size and approximate keys of 0 to be in an abnormal state and will not merge them. Is this true? Also, I would like to know how such regions are generated? How can they be avoided or cleaned up?

If the default is to merge to the right, is there a way to set it to merge to the left?

| username: h5n1 | Original post link

It’s not normal for the count to be zero. These two metrics are estimates and not 100% accurate. They might be regions left after truncate drop, and you’ll have to wait for them to merge. You can first check the region’s table information from information_schema.tikv_region_status or by using curl http://{TiDBIP}:10080/regions/{regionID}.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.