Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: region的合并是怎么发起的?
【TiDB Usage Environment】Production\Test Environment\POC
【TiDB Version】
【Encountered Issues】
【Reproduction Path】What operations were performed to cause the issue
【Issue Phenomenon and Impact】
【Attachments】
- Relevant logs, configuration files, Grafana monitoring (https://metricstool.pingcap.com/)
- TiUP Cluster Display information
- TiUP Cluster Edit config information
- TiDB-Overview monitoring
- Corresponding module’s Grafana monitoring (if any, such as BR, TiDB-binlog, TiCDC, etc.)
- Corresponding module logs (including logs from 1 hour before and after the issue)
If the question is related to performance optimization or troubleshooting, please download the script and run it. Please select all and copy-paste the terminal output results for upload.
Region merging is initiated by PD scheduling. Regions periodically send heartbeat information, which includes the boundary information of the region. If the boundary information meets the conditions for merging and can be merged with other regions, PD will initiate a merge scheduling request. TiKV will then execute the merge, create a new region, and release the old regions.
You can refer to this article TiKV 源码解析系列文章(二十一)Region Merge 源码解析 | PingCAP
Triggering of Merge
Similar to Split and Conf Change, PD acts as the initiator. However, unlike Split, the triggering of Merge is entirely determined by PD:
If the size of a Region is greater than max-merge-region-size (default 20MB) or the number of keys is greater than max-merge-region-keys (default 200000), Merge will not be triggered.
For newly Split Regions, Merge will not be triggered within a period defined by split-merge-interval (default 1h).
Ensure that all Peers of the Source Region and Target Region exist, which is information obtained through reports from the Region Leader to PD.
There are also some other triggering conditions that belong to internal mechanisms, which are beyond the scope of this article.
After PD decides that a certain Source Region needs to Merge into an adjacent Target Region, it will align their Peers to the same TiKV through Conf Change, and then send a request to the Region to trigger the Merge.
Region merging is a scheduling task of PD, and you can also manually add some schedulers.
The image is not visible. Please provide the text you need translated.
It is somewhat similar to the concept of high water mark in Oracle.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.