表设置高级放置规则后,创建tiflash副本并不会copy数据到tiflash, tiflash PROGRESS状态一直处于0。

$ tiup ctl:v5.3.0 pd -u http://172.29.253.202:2379 config placement show
Starting component ctl: /home/tidb/.tiup/components/ctl/v5.3.0/ctl pd -u http://172.29.253.202:2379 config placement show
[
{
“group_id”: “TiDB_DDL_12745”,
“id”: “table_rule_12745_0”,
“index”: 2,
“start_key”: “7480000000000031ffc900000000000000f8”,
“end_key”: “7480000000000031ffca00000000000000f8”,
“role”: “voter”,
“count”: 2,
“label_constraints”: [
{
“key”: “zone”,
“op”: “in”,
“values”: [
“sh”
]
},
{
“key”: “dc”,
“op”: “in”,
“values”: [
“sha”
]
},
{
“key”: “rack”,
“op”: “in”,
“values”: [
“rack1”
]
},
{
“key”: “disk”,
“op”: “in”,
“values”: [
“hdd”
]
},
{
“key”: “engine”,
“op”: “notIn”,
“values”: [
“tiflash”
]
}
],
“location_labels”: [
“region”,
“zone”,
“rack”,
“host”
],
“isolation_level”: “region”,
“create_timestamp”: 1640167483
},
{
“group_id”: “TiDB_DDL_12745”,
“id”: “table_rule_12745_1”,
“index”: 2,
“start_key”: “7480000000000031ffc900000000000000f8”,
“end_key”: “7480000000000031ffca00000000000000f8”,
“role”: “leader”,
“count”: 1,
“label_constraints”: [
{
“key”: “engine”,
“op”: “notIn”,
“values”: [
“tiflash”
]
}
],
“create_timestamp”: 1640167483
},
{
“group_id”: “pd”,
“id”: “default”,
“start_key”: “”,
“end_key”: “”,
“role”: “voter”,
“count”: 3,
“location_labels”: [
“zone”,
“dc”,
“rack”,
“host”,
“disk”
],
“version”: 2
},
{
“group_id”: “tiflash”,
“id”: “table-11422-r”,
“override”: true,
“start_key”: “748000000000002CFF9E5F720000000000FA”,
“end_key”: “748000000000002CFF9F00000000000000F8”,
“role”: “learner”,
“count”: 2,
“label_constraints”: [
{
“key”: “engine”,
“op”: “in”,
“values”: [
“tiflash”
]
}
],
“create_timestamp”: 1640161956
},
{
“group_id”: “tiflash”,
“id”: “table-12745-r”,
“override”: true,
“start_key”: “7480000000000031FFC95F720000000000FA”,
“end_key”: “7480000000000031FFCA00000000000000F8”,
“role”: “learner”,
“count”: 2,
“label_constraints”: [
{
“key”: “engine”,
“op”: “in”,
“values”: [
“tiflash”
]
}
],
“create_timestamp”: 1640168396
}
]

没有设置放置规则的tiflash正常同步,设置了放置规则的tiflash不同步

MySQL [sbtest2]> select * from information_schema.tiflash_replica ;
±-------------±-----------±---------±--------------±----------------±----------±---------+
| TABLE_SCHEMA | TABLE_NAME | TABLE_ID | REPLICA_COUNT | LOCATION_LABELS | AVAILABLE | PROGRESS |
±-------------±-----------±---------±--------------±----------------±----------±---------+
| sbtest2 | sbtest2 | 11422 | 2 | | 1 | 1 |
| sbtest2 | sbtest3 | 12745 | 2 | | 0 | 0 |
±-------------±-----------±---------±--------------±----------------±----------±---------+

放置规则:

MySQL [sbtest2]> show placement;
±----------------------±--------------------------------------------------------------------------------±-----------------+
| Target | Placement | Scheduling_State |
±----------------------±--------------------------------------------------------------------------------±-----------------+
| POLICY p1 | FOLLOWERS=2 FOLLOWER_CONSTRAINTS="{"+zone=sh,+dc=sha,+rack=rack1,+disk=hdd":2}" | NULL |
| TABLE sbtest2.sbtest3 | FOLLOWERS=2 FOLLOWER_CONSTRAINTS="{"+zone=sh,+dc=sha,+rack=rack1,+disk=hdd":2}" | INPROGRESS |
±----------------------±--------------------------------------------------------------------------------±-----------------+
2 rows in set (0.01 sec)

2 个赞
  • 不能通过放置规则语法配置 TiFlash 副本。

https://docs.pingcap.com/zh/tidb/stable/placement-rules-in-sql

1 个赞

后续会打算支持嘛,有些冷数据既要放置规则,又要tiflash

这个可能需要呼叫研发大佬来回答下了(理论上应该会覆盖

我们 PM 会梳理让 placement rule 也包含 tiflash 的合理用况哈。

大佬亲自回复:smiley::call_me_hand:

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。