通过PLACEMENT POLICY增加Learner副本不生效

按照placement-rules-in-sql#高级放置选项说明,7.5是支持设置Learner副本个数的,但是按照下面操作实际操作时,发现调度一直处于INPROGRESS的状态。

CREATE PLACEMENT POLICY add_oltp_leaner CONSTRAINTS="[-disk=sata]" LEARNERS=1 ;
ALTER TABLE test.t_partition PARTITION p202304  PLACEMENT POLICY add_oltp_leaner;
SHOW PLACEMENT where Target like '%test.t_partition%';

1 个赞

有没有日志哦

奇怪的是PD里只有一个修改Placement Rule的日志,但是执行operator show会发现什么也没有,但是就是一直处于INPROGRESS的状态

是不是由于网络、系统的压力还没成功,等一下观察下

昨天下午修改的,到现在已经超过12小时了。另外这个表是个测试表,总数据量才几十万,其实最主要是Operator没有生成,不知道现在是卡在哪个步骤了。

1 个赞

mark 一下。place rules 和 label 把我搞糊涂了,学习中

没生效吧,只是设置了

感觉这就是一个bug。

你这个的意思是所有角色都不要放在 sata 上,然后有一个 learner 吧。还有一点记得指定生存偏好

是的,真实需求就是这样,不过测试时候发现可能哪里设置的不对,一直没有生效。

你的集群拓扑是如何的,可以发下 dashboard 上的那个图


总共有三个DC,这里截图了一个dc的拓扑,其他两个DC也都是类似,每个DC分了有三类Label,但是感觉和这个关系应该不大,毕竟用的是-disk排除某类Label

麻烦给一下以下信息:

  1. PD 里 Learner 对应这条的 placement rules
  2. show table test.t_partion regions 对应的 region 数据,最好能值知道到对应 partition 的。
  3. PD rule checker 的监控

估计是表的压力的问题,一直没成功?

  1. PD里对应的Rule是:
{
  "group_id": "TiDB_DDL_45199",
  "group_index": 80,
  "group_override": true,
  "rules": [
    {
      "group_id": "TiDB_DDL_45199",
      "id": "partition_rule_45199_0",
      "index": 40,
      "start_key": "74800000000000b0ff8f00000000000000f8",
      "end_key": "74800000000000b0ff9000000000000000f8",
      "role": "voter",
      "is_witness": false,
      "count": 3,
      "label_constraints": [
        {
          "key": "disk",
          "op": "notIn",
          "values": [
            "sata"
          ]
        },
        {
          "key": "engine",
          "op": "notIn",
          "values": [
            "tiflash"
          ]
        }
      ],
      "create_timestamp": 1713431877
    },
    {
      "group_id": "TiDB_DDL_45199",
      "id": "partition_rule_45199_1",
      "index": 40,
      "start_key": "74800000000000b0ff8f00000000000000f8",
      "end_key": "74800000000000b0ff9000000000000000f8",
      "role": "learner",
      "is_witness": false,
      "count": 1,
      "label_constraints": [
        {
          "key": "disk",
          "op": "notIn",
          "values": [
            "sata"
          ]
        },
        {
          "key": "engine",
          "op": "notIn",
          "values": [
            "tiflash"
          ]
        }
      ],
      "create_timestamp": 1713431877
    }
  ]
}

  1. show table test.t_partion regions能看到一些region的状态确实是处于PENDING状态
*************************** 63. row ***************************
             REGION_ID: 15631951
             START_KEY: t_45197_
               END_KEY: t_45198_
             LEADER_ID: 15631954
       LEADER_STORE_ID: 1
                 PEERS: 15631952, 15631953, 15631954
            SCATTERING: 0
         WRITTEN_BYTES: 39
            READ_BYTES: 0
  APPROXIMATE_SIZE(MB): 1
      APPROXIMATE_KEYS: 0
SCHEDULING_CONSTRAINTS: CONSTRAINTS="[-disk=sata]"
      SCHEDULING_STATE: SCHEDULED
*************************** 64. row ***************************
             REGION_ID: 15631955
             START_KEY: t_45198_
               END_KEY: t_45199_
             LEADER_ID: 15631956
       LEADER_STORE_ID: 4
                 PEERS: 15631956, 15631957, 15631958
            SCATTERING: 0
         WRITTEN_BYTES: 0
            READ_BYTES: 0
  APPROXIMATE_SIZE(MB): 1
      APPROXIMATE_KEYS: 0
SCHEDULING_CONSTRAINTS: CONSTRAINTS="[-disk=sata]"
      SCHEDULING_STATE: SCHEDULED
*************************** 65. row ***************************
             REGION_ID: 15635914
             START_KEY: t_45199_i_1_0419afd60000000000013132343100000000fb013100000000000000f80380000000002771cf013034383132363030ff0000000000000000f7014341425534493449ff4c324d4e34430000fd01434c303030303531ff3538000000000000f9013031323034310000fd
               END_KEY: t_45199_r_72057594042656696
             LEADER_ID: 15635916
       LEADER_STORE_ID: 2
                 PEERS: 15635915, 15635916, 15635917
            SCATTERING: 0
         WRITTEN_BYTES: 0
            READ_BYTES: 0
  APPROXIMATE_SIZE(MB): 44
      APPROXIMATE_KEYS: 273502
SCHEDULING_CONSTRAINTS: CONSTRAINTS="[-disk=sata]" LEARNERS=1
      SCHEDULING_STATE: PENDING
*************************** 66. row ***************************
             REGION_ID: 15635894
             START_KEY: t_45199_r_72057594042656696
               END_KEY: t_45199_r_648518346345467670
             LEADER_ID: 15635895
       LEADER_STORE_ID: 4
                 PEERS: 15635895, 15635896, 15635897
            SCATTERING: 0
         WRITTEN_BYTES: 0
            READ_BYTES: 0
  APPROXIMATE_SIZE(MB): 101
      APPROXIMATE_KEYS: 669709
SCHEDULING_CONSTRAINTS: CONSTRAINTS="[-disk=sata]" LEARNERS=1
      SCHEDULING_STATE: PENDING

不过这个监控没有找到,能给下详细的在grafana哪个dashboard上么?


过了一会儿,这个region的状态又从pending变成INPROGRESS了