在进行D区TiKV机器替换时发现,当使用了Placement policy后,在扩缩容时,所有节点的Region都会增加/减少,并没有局限在D区内。Region变化曲线如下:
- 默认的
PLACEMENT POLICY
内,D区替换TiKV的Region个数曲线为:
- 使用其他
PLACEMENT POLICY
后,D区替换TiKV的Region个数曲线为:
直接用pd-ctl看PD内的Placement Rule,两者内容如下
-
- 默认的全局策略,里边包含location_labels内容
{
"group_id": "pd",
"group_index": 0,
"group_override": false,
"rules": [
{
"group_id": "pd",
"id": "default",
"start_key": "",
"end_key": "",
"role": "voter",
"is_witness": false,
"count": 3,
"label_constraints": [
{
"key": "disk",
"op": "notIn",
"values": [
"sata",
"sata-new",
"dw-ssd"
]
}
],
"location_labels": [
"zone",
"dc",
"host"
]
}
]
},
-
- 使用了
Placement rule in SQL
产生的则如下,缺少location_labels
内容
- 使用了
{
"group_id": "TiDB_DDL_89632",
"id": "partition_rule_89632_1",
"index": 40,
"start_key": "748000000000015eff2000000000000000f8",
"end_key": "748000000000015eff2100000000000000f8",
"role": "voter",
"is_witness": false,
"count": 2,
"label_constraints": [
{
"key": "disk",
"op": "in",
"values": [
"dw-ssd"
]
},
{
"key": "engine",
"op": "notIn",
"values": [
"tiflash"
]
}
],
"create_timestamp": 1706864872
}