Skip to content

Commit b1fa73e

Browse files
author
anotherrachel
committed
reference: add PD scheduling best practice and glossary
1 parent e7e0336 commit b1fa73e

File tree

2 files changed

+317
-0
lines changed

2 files changed

+317
-0
lines changed

dev/glossary.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Glossary
3+
summary: Glossaries about TiDB.
4+
category: glossary
5+
---
6+
7+
# Glossary
8+
9+
## L
10+
11+
### Leader/Follower/Learner
12+
13+
Leader/Follower/Learner each corresponds to three roles in a group of [Peers](#regionpeerraft-group). The Leader services all client requests and replicated data to the Followers. If the group Leader fails, one of the Followers will be elected as the new Leader. Learners are non-voting Followers that only synchronizes raft logs, and currently exists briefly in the process of replica addition.
14+
15+
## O
16+
17+
### Operator
18+
19+
An Operator is a collection of actions that applies to a Region and serves a scheduling purpose. For example, "migrate Region 2 Leader to Store 5", "migrate a replica of Region 2 to Store 1, 4, 5".
20+
21+
An Operator can be computed and generated by a Scheduler, or created by an external API.
22+
23+
### Operator Step
24+
25+
An Operator Step is a step in the execution of an Operator. An Operator normally contains multiple Operator steps.
26+
27+
Currently, available Steps generated by PD include:
28+
29+
- `TransferLeader`: migrate a Region Leader to a specified Peer
30+
- `AddPeer`: add Followers to a specified Store
31+
- `RemovePeer`: delete a Region Peer
32+
- `AddLearner`: add a Region Learner to a specified Store
33+
- `PromoteLearner`: promote a specified Learner to a voting member
34+
- `SplitRegion`: split a Region in two
35+
36+
## P
37+
38+
### `Pending`/`Down`
39+
40+
`Pending` and `Down` are two special states of Peer. `Pending` indicates that the raft log of Followers or Learners is vastly different from that of Leader, and Followers in `Pending` cannot be elected as Leader. `Down` refers to a state that a Peer ceases to respond to the corresponding Leader for a long time, which usually means that the corresponding node is down or isolated from the network.
41+
42+
## R
43+
44+
### Region/Peer/Raft Group
45+
46+
Each Region maintains a continuous piece of data for the cluster (an average of about 96 MiB by default), each of which stores multiple replicas in different Stores (3 replicas by default) and each replica is referred as a Peer. Multiple Peers of the same Region synchronize data via raft protocol, so Peers also refer to members of a raft instance. TiKV uses the multi-raft pattern to manage data, that is, each Region has a corresponding, standalone raft instance (also known as a Raft Group).
47+
48+
### Region Split
49+
50+
Regions in the TiKV cluster are gradually split and generated as the written data accrues. The process of splitting is called Region Split.
51+
52+
The mechanism of Region Split is to build an initial Region to cover the entire key space in cluster initialization, and then generate a new Region through Split every time the Region data reaches a certain amount.
53+
54+
## S
55+
56+
### Scheduler
57+
58+
Scheduler is a component in PD that generates scheduling tasks. Each scheduler in PD runs independently and serves different purposes. Common schedulers and their purposes are:
59+
60+
- `balance-leader-scheduler`: maintain Leader balance of different nodes
61+
- `balance-region-scheduler`: maintain Peer balance of different nodes
62+
- `hot-region-scheduler`: maintain hot Region balance of different nodes
63+
- `evict-leader-{store-id}`: remove all Leaders of a node (often used for rolling upgrades)
64+
65+
### Store
66+
67+
A Store in PD refers to the storage node in the cluster, also a instance of tikv-server. Each Store has a corresponding TiKV instance, which means if multiple TiKV instances are deployed on the same host or even on the same disk, these instances still correspond to different Stores.

0 commit comments

Comments
 (0)