[TiDB Usage Environment] Production Environment
[TiDB Version] 5.3.0
[Reproduction Path] Scheduled task truncates the table daily, then inserts over 40 million data entries.
[Encountered Problem: Symptoms and Impact]
Monitoring shows an increase in regions and memory, with a large number of empty regions generated at that time.
Through the TIKV_REGION_STATUS table, it is observed that regions with database and table names from yesterday have become null today. The data table was truncated and then new data was added.
This post TIKV_REGION_STATUS存在大量dbname table_name等字段都为null的记录 - TiDB 的问答社区 mentions it is a GC issue but does not specify how to resolve it.
If it hasn’t been garbage collected (GC), you need to wait for it to be GC’d first. After the GC is done, use tikvctl to check the size of the region corresponding to the region_id. Also, check the max-merge-region-size parameter to see how large it is set and whether it is small enough to require merging the region.