Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 空region不合并
[TiDB Usage Environment] Online
[TiDB Version] v5.0.6
[Encountered Problem] A large number of regions around 1M are not merging
[Reproduction Path] What operations were performed to cause the problem
[Problem Phenomenon and Impact]
Empty regions cannot be recycled. Most of the empty regions belong to tables without data, but enable-cross-table-merge has been enabled. I don’t know why they are not merging.
[Attachment]
Refer to this link for more information:
The enable-cross-table-merge
is false
by default. If set to true, it allows merging two regions from different tables. This option is only effective when the key type
is “table”.
TiKV parameters:
split-region-on-table
, default value is true, which enables splitting Regions by table. To facilitate merging empty regions, this should be set to false.
I see all the parameters are correct.
Does the cluster have tasks that periodically delete large amounts of data? We have tasks that regularly delete large amounts of data every day, and we have a similar situation where the number of empty regions decreases daily, then increases again after deleting large amounts of data, showing a fluctuation that matches our expectations.
schedule.enable-cross-table-merge
coprocessor.split-region-on-table false
Try reducing the schedule.split-merge-interval time (the default is to merge once every 2 hours).
Is there TiFlash? Check with pd-ctl scheduler show
.
There are a large number of truncates, but currently there is no fluctuation. These empty regions just do not merge.
Check if the PD has a region merge checker panel.
Yes, but empty still doesn’t merge.
Find two adjacent empty regions, where the end key of the first region is the same as the start key of the second region. Manually initiate a merge using pd-ctl operator add merge-region 1 2
, then observe the PD leader logs and TiKV logs to check the merge status.
Try adjusting the max-merge-region-keys and max-merge-region-size to be smaller, set the split-merge-interval to 1 minute, and moderately increase the store limit.
After the merge, one TiFlash node crashed and couldn’t start, and the number of down peers increased.
Isn’t this value supposed to prevent merging if it’s greater? If it’s reduced, wouldn’t it prevent merging even more?
Not all tables are synchronized on TiFlash, right?
No, it’s partial table synchronization. I’m not sure if the empty regions are related to TiFlash. After operating the operator to add merge-region with two region IDs, TiFlash crashed.
Please upload the TiFlash error logs, and wait for the TiFlash expert to take a look.
Link: 百度网盘-链接不存在 Extraction code: 73ix
The log is quite large. The operation started at 09:38 with the operator add merge-region for two region IDs.