-
Notifications
You must be signed in to change notification settings - Fork 5.8k
/
config.go
45 lines (39 loc) · 2.23 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2022 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package pdtypes
// ReplicationConfig is the replication configuration.
type ReplicationConfig struct {
// MaxReplicas is the number of replicas for each region.
MaxReplicas uint64 `toml:"max-replicas" json:"max-replicas"`
// The label keys specified the location of a store.
// The placement priorities is implied by the order of label keys.
// For example, ["zone", "rack"] means that we should place replicas to
// different zones first, then to different racks if we don't have enough zones.
LocationLabels StringSlice `toml:"location-labels" json:"location-labels"`
// StrictlyMatchLabel strictly checks if the label of TiKV is matched with LocationLabels.
StrictlyMatchLabel bool `toml:"strictly-match-label" json:"strictly-match-label,string"`
// When PlacementRules feature is enabled. MaxReplicas, LocationLabels and IsolationLabels are not used any more.
EnablePlacementRules bool `toml:"enable-placement-rules" json:"enable-placement-rules,string"`
// EnablePlacementRuleCache controls whether use cache during rule checker
EnablePlacementRulesCache bool `toml:"enable-placement-rules-cache" json:"enable-placement-rules-cache,string"`
// IsolationLevel is used to isolate replicas explicitly and forcibly if it's not empty.
// Its value must be empty or one of LocationLabels.
// Example:
// location-labels = ["zone", "rack", "host"]
// isolation-level = "zone"
// With configuration like above, PD ensure that all replicas be placed in different zones.
// Even if a zone is down, PD will not try to make up replicas in other zone
// because other zones already have replicas on it.
IsolationLevel string `toml:"isolation-level" json:"isolation-level"`
}