pingcap/tidb

Improve the error report of placement rule

Open

#47,253 opened on Sep 25, 2023

View on GitHub
 (4 comments) (0 reactions) (1 assignee)Go (40,090 stars) (6,186 forks)batch import
good first issuetype/enhancement

Description

Enhancement

mysql> show placement;
+--------------------+-----------------------------------------------------------------------------------------------------+------------------+
| Target             | Placement                                                                                           | Scheduling_State |
+--------------------+-----------------------------------------------------------------------------------------------------+------------------+
| POLICY all_in_east | CONSTRAINTS="[+region=us-east-1]"                                                                   | NULL             |
| POLICY mydeploy    | FOLLOWER_CONSTRAINTS="{ \"+region=us-east-1\":1, \"+region=us-east-2\": 2, \"+region=us-west\": 1}" | NULL             |
| TABLE test.t       | CONSTRAINTS="[+region=us-east-1]"                                                                   | PENDING          |
| TABLE test.t1      | CONSTRAINTS="[+region=us-east-1]"                                                                   | PENDING          |
+--------------------+-----------------------------------------------------------------------------------------------------+------------------+
4 rows in set (0.00 sec)

mysql> alter table t placement policy mydeploy;
ERROR 8243 (HY000): "[PD:placement:ErrRuleContent]invalid rule content, rule 'table_rule_105_1' from rule group 'TiDB_DDL_105' can not match any store"

I don't know why 'TiDB_DDL_105' can not match any store, and which policy has problem.

Details Topogy:

{
  "count": 5,
  "stores": [
    {
      "store": {
        "id": 1,
        "address": "127.0.0.1:20163",
        "labels": [
          {
            "key": "region",
            "value": "us-east-1"
          }
        ],
        "version": "7.3.0",
        "peer_address": "127.0.0.1:20163",
        "status_address": "127.0.0.1:20183",
        "git_hash": "076c6a03cba91b6e9a2e5b227a800f98a01c53e5",
        "start_timestamp": 1695628575,
        "deploy_path": "/Users/nolouch/.tiup/components/tikv/v7.3.0",
        "last_heartbeat": 1695635849824517000,
        "state_name": "Up"
      },
      "status": {
        "capacity": "926.4GiB",
        "available": "425.9GiB",
        "used_size": "289.1MiB",
        "leader_count": 3,
        "leader_weight": 1,
        "leader_score": 3,
        "leader_size": 3,
        "region_count": 5,
        "region_weight": 1,
        "region_score": 7.513273365437039,
        "region_size": 5,
        "slow_score": 1,
        "slow_trend": {
          "cause_value": 250019.23333333334,
          "cause_rate": 0,
          "result_value": 0,
          "result_rate": 0
        },
        "start_ts": "2023-09-25T15:56:15+08:00",
        "last_heartbeat_ts": "2023-09-25T17:57:29.824517+08:00",
        "uptime": "2h1m14.824517s"
      }
    },
    {
      "store": {
        "id": 2,
        "address": "127.0.0.1:20162",
        "labels": [
          {
            "key": "region",
            "value": "us-east-1"
          }
        ],
        "version": "7.3.0",
        "peer_address": "127.0.0.1:20162",
        "status_address": "127.0.0.1:20182",
        "git_hash": "076c6a03cba91b6e9a2e5b227a800f98a01c53e5",
        "start_timestamp": 1695628575,
        "deploy_path": "/Users/nolouch/.tiup/components/tikv/v7.3.0",
        "last_heartbeat": 1695635849704162000,
        "state_name": "Up"
      },
      "status": {
        "capacity": "926.4GiB",
        "available": "425.9GiB",
        "used_size": "289.5MiB",
        "leader_count": 3,
        "leader_weight": 1,
        "leader_score": 3,
        "leader_size": 3,
        "region_count": 6,
        "region_weight": 1,
        "region_score": 9.015928071609622,
        "region_size": 6,
        "slow_score": 1,
        "slow_trend": {
          "cause_value": 250016.55,
          "cause_rate": 0,
          "result_value": 0,
          "result_rate": 0
        },
        "start_ts": "2023-09-25T15:56:15+08:00",
        "last_heartbeat_ts": "2023-09-25T17:57:29.704162+08:00",
        "uptime": "2h1m14.704162s"
      }
    },
    {
      "store": {
        "id": 3,
        "address": "127.0.0.1:20164",
        "labels": [
          {
            "key": "region",
            "value": "us-east-2"
          }
        ],
        "version": "7.3.0",
        "peer_address": "127.0.0.1:20164",
        "status_address": "127.0.0.1:20184",
        "git_hash": "076c6a03cba91b6e9a2e5b227a800f98a01c53e5",
        "start_timestamp": 1695628575,
        "deploy_path": "/Users/nolouch/.tiup/components/tikv/v7.3.0",
        "last_heartbeat": 1695635849974441000,
        "state_name": "Up"
      },
      "status": {
        "capacity": "926.4GiB",
        "available": "425.9GiB",
        "used_size": "289MiB",
        "leader_count": 0,
        "leader_weight": 1,
        "leader_score": 0,
        "leader_size": 0,
        "region_count": 6,
        "region_weight": 1,
        "region_score": 9.015927997013208,
        "region_size": 6,
        "slow_score": 1,
        "slow_trend": {
          "cause_value": 250017.025,
          "cause_rate": 0,
          "result_value": 0,
          "result_rate": 0
        },
        "start_ts": "2023-09-25T15:56:15+08:00",
        "last_heartbeat_ts": "2023-09-25T17:57:29.974441+08:00",
        "uptime": "2h1m14.974441s"
      }
    },
    {
      "store": {
        "id": 4,
        "address": "127.0.0.1:20160",
        "labels": [
          {
            "key": "region",
            "value": "us-east-2"
          }
        ],
        "version": "7.3.0",
        "peer_address": "127.0.0.1:20160",
        "status_address": "127.0.0.1:20180",
        "git_hash": "076c6a03cba91b6e9a2e5b227a800f98a01c53e5",
        "start_timestamp": 1695628575,
        "deploy_path": "/Users/nolouch/.tiup/components/tikv/v7.3.0",
        "last_heartbeat": 1695635849663426000,
        "state_name": "Up"
      },
      "status": {
        "capacity": "926.4GiB",
        "available": "425.9GiB",
        "used_size": "289.1MiB",
        "leader_count": 0,
        "leader_weight": 1,
        "leader_score": 0,
        "leader_size": 0,
        "region_count": 5,
        "region_weight": 1,
        "region_score": 7.513272089020848,
        "region_size": 5,
        "slow_score": 1,
        "slow_trend": {
          "cause_value": 250018.1,
          "cause_rate": 0,
          "result_value": 0,
          "result_rate": 0
        },
        "start_ts": "2023-09-25T15:56:15+08:00",
        "last_heartbeat_ts": "2023-09-25T17:57:29.663426+08:00",
        "uptime": "2h1m14.663426s"
      }
    },
    {
      "store": {
        "id": 5,
        "address": "127.0.0.1:20161",
        "labels": [
          {
            "key": "region",
            "value": "us-west-1"
          }
        ],
        "version": "7.3.0",
        "peer_address": "127.0.0.1:20161",
        "status_address": "127.0.0.1:20181",
        "git_hash": "076c6a03cba91b6e9a2e5b227a800f98a01c53e5",
        "start_timestamp": 1695628575,
        "deploy_path": "/Users/nolouch/.tiup/components/tikv/v7.3.0",
        "last_heartbeat": 1695635849693885000,
        "state_name": "Up"
      },
      "status": {
        "capacity": "926.4GiB",
        "available": "425.9GiB",
        "used_size": "289.2MiB",
        "leader_count": 3,
        "leader_weight": 1,
        "leader_score": 3,
        "leader_size": 3,
        "region_count": 5,
        "region_weight": 1,
        "region_score": 7.513273381969006,
        "region_size": 5,
        "slow_score": 1,
        "slow_trend": {
          "cause_value": 250020.06666666668,
          "cause_rate": 0,
          "result_value": 9,
          "result_rate": 0
        },
        "start_ts": "2023-09-25T15:56:15+08:00",
        "last_heartbeat_ts": "2023-09-25T17:57:29.693885+08:00",
        "uptime": "2h1m14.693885s"
      }
    }
  ]
}

Contributor guide