Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 删除region
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots / Logs / Monitoring]
select * from INFORMATION_SCHEMA.TIKV_REGION_STATUS trs Query found that there is a region with table_id and db_id as null
I would like to ask under what circumstances this null situation is formed, and if I want to delete the corresponding region, how should I proceed?
There’s no need to delete regions. If there are empty regions, the system will automatically merge or clean them up.
I checked the current size of this region, which is 35M, but the parameter is set to 20. Should I modify the parameter?
Was there a large amount of data deletion before, resulting in many small regions? The system will automatically perform Region Merge after version 3.0.
If there are no special requirements for the region parameters, don’t adjust them…
The default parameters provided are generally the result of many tests and can adapt to most scenarios.
Then you can change it to greater than 35M, and after merging, change it back to the default 20M
But the monitoring panel does not show any empty regions.
I’ll give it a try to see if it works. If it does, the query “select * from INFORMATION_SCHEMA.TIKV_REGION_STATUS trs” should not display null values, right?
The monitoring shows that there are no empty regions, which feels quite strange.
That is normal. The range of a region is divided by Key_start and Key_end. If there is no value, it represents infinitely small or infinitely large. This allows data outside the divided range to be accommodated.
After the modification, the query indeed shows that this region no longer exists.
My region doesn’t have a start_key.
In simple terms, it’s extremely small. If you say there’s nothing, there’s still a tiny bit inside, haha. After merging, remember to change it back to 20M, and it’ll be fine.
Indeed, saying there is none is a bit off, but saying there is some isn’t much either. It has already been reverted.
I encountered the same issue, thanks to the experts.
Use the command tikv-ctl pd destroy-region {region_id}
to destroy the corresponding region based on the region ID.
Where did you see this command?