From 4108ed74db2a15d4ad56e865ea173479dfcef53a Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Thu, 1 Dec 2022 15:44:02 +0800 Subject: [PATCH] tikv: updated description of region size (#11480) --- tidb-storage.md | 2 +- tikv-overview.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tidb-storage.md b/tidb-storage.md index 8cb3213c4d1cd..ee2c0115f257f 100644 --- a/tidb-storage.md +++ b/tidb-storage.md @@ -49,7 +49,7 @@ To make it easy to understand, let's assume that all data only has one replica. * Hash: Create Hash by Key and select the corresponding storage node according to the Hash value. * Range: Divide ranges by Key, where a segment of serial Key is stored on a node. -TiKV chooses the second solution that divides the whole Key-Value space into a series of consecutive Key segments. Each segment is called a Region. There is a size limit for each Region to store data (the default value is 96 MB and the size can be configured). Each Region can be described by `[StartKey, EndKey)`, a left-closed and right-open interval. +TiKV chooses the second solution that divides the whole Key-Value space into a series of consecutive Key segments. Each segment is called a Region. Each Region can be described by `[StartKey, EndKey)`, a left-closed and right-open interval. The default size limit for each Region is 96 MiB and the size can be configured. ![Region in TiDB](/media/tidb-storage-2.png) diff --git a/tikv-overview.md b/tikv-overview.md index 16662510c2dd9..5934f8d8cd1fb 100644 --- a/tikv-overview.md +++ b/tikv-overview.md @@ -21,7 +21,7 @@ There is a RocksDB database within each Store and it stores data into the local Data consistency between replicas of a Region is guaranteed by the Raft Consensus Algorithm. Only the leader of the Region can provide the writing service, and only when the data is written to the majority of replicas of a Region, the write operation succeeds. -When the size of a Region exceeds a threshold, which is 144 MB by default, TiKV splits it to two or more Regions. This operation guarantees the size of all the Regions in the cluster is nearly the same, which helps the PD component to balance Regions among nodes in a TiKV cluster. When the size of a Region is smaller than the threshold, TiKV merges the two smaller adjacent Regions into one Region. +TiKV tries to keep an appropriate size for each Region in the cluster. The Region size is currently 96 MiB by default. This mechanism helps the PD component to balance Regions among nodes in a TiKV cluster. When the size of a Region exceeds a threshold (144 MiB by default), TiKV splits it into two or more Regions. When the size of a Region is smaller than the threshold (20 MiB by default), TiKV merges the two smaller adjacent Regions into one Region. When PD moves a replica from one TiKV node to another, it firstly adds a Learner replica on the target node, after the data in the Learner replica is nearly the same as that in the Leader replica, PD changes it to a Follower replica and removes the Follower replica on the source node.