Update region-merge.md

This commit is contained in:
Connor 2019-09-16 11:21:28 +08:00 committed by GitHub
parent 7f87cdc80d
commit b27463a9fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -7,20 +7,19 @@ menu:
weight: 5
---
TiKV replicates a segment of data in Regions via the Raft state machine. As data writes increase, a Region Split happens when the size of the region or the number of keys has reached a threshold. Conversely, if the size of the Region or the amount of keys shrinks because of data deletion, we can use Region Merge to merge adjacent regions that are smaller. This relieves some stress on Raftstore.
TiKV replicates a segment of data in Regions via the Raft state machine. As data writes increase, a Region Split happens when the size of the region or the number of keys has reached a threshold. Conversely, if the size of the Region and the amount of keys shrinks because of data deletion, we can use Region Merge to merge adjacent regions that are smaller. This relieves some stress on Raftstore.
## Merge process
Region Merge is initiated by the Placement Driver (PD). The steps are:
1. PD polls the sizes and number of keys of all regions on the TiKV node.
1. PD polls the meta information of Regions constantly.
2. When the region size is less than `max-merge-region-size` or the number of keys the region includes is less than `max-merge-region-keys`, PD performs Region Merge on the smaller of the two adjacent Regions.
2. If the region size is less than `max-merge-region-size` and the number of keys the region includes is less than `max-merge-region-keys`, PD performs Region Merge on the region with the smaller one of the two adjacent Regions.
**Note:**
- All replicas of the merged Regions must belong to the same set of TiKVs.
- All replicas of the two Regions to be merged must locate on the same set of TiKVs (It is ensured by PD scheduler).
- Newly split Regions won't be merged within the period of time specified by `split-merge-interval`.
- Region Merge won't happen within the period of time specified by `split-merge-interval` after PD starts or restarts.
- Region Merge won't happen for two Regions that belong to different tables if `namespace-classifier = table` (default).