Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal output from "get regions by state" #6560

Closed
v01dstar opened this issue Jun 6, 2023 · 0 comments · Fixed by #6804
Closed

Abnormal output from "get regions by state" #6560

v01dstar opened this issue Jun 6, 2023 · 0 comments · Fixed by #6804
Assignees
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@v01dstar
Copy link
Contributor

v01dstar commented Jun 6, 2023

Bug Report

What did you do?

Run get regions by state (pending peer) and get region by id commands while investigating #6559.

What did you expect to see?

Same region should have the same (or almost the same) info.

What did you see instead?

Inconsistent, and the output of get regions by state looks strange.

get regions by state's output comes from stats, while get region by id's output comes from "region info", the real question is probably why get regions by state is not up-to-date or wrong

Output of get regions by state

{
  "count": 3,
  "regions": [
    {
      "id": 55929554,
      "epoch": {
        "conf_ver": 6,
        "version": 109399
      },
      "peers": [
        {
          "id": 55929555,
          "store_id": 1,
          "role_name": "Voter"
        },
        {
          "id": 55929556,
          "store_id": 4,
          "role_name": "Voter"
        },
        {
          "id": 55929557,
          "store_id": 5,
          "role_name": "Voter"
        },
        {
          "id": 55929558,
          "store_id": 2751139,
          "role": 1,
          "role_name": "Learner",
          "is_learner": true
        }
      ],
      "leader": {
        "id": 55929555,
        "store_id": 1,
        "role_name": "Voter"
      },
      "pending_peers": [
        {
          "id": 55929556,
          "store_id": 4,
          "role_name": "Voter"
        },
        {
          "id": 55929557,
          "store_id": 5,
          "role_name": "Voter"
        },
        {
          "id": 55929558,
          "store_id": 2751139,
          "role": 1,
          "role_name": "Learner",
          "is_learner": true
        }
      ]
    },
    {
      "id": 638281173,
      "epoch": {
        "conf_ver": 6,
        "version": 109421
      },
      "peers": [
        {
          "id": 638281174,
          "store_id": 1,
          "role_name": "Voter"
        },
        {
          "id": 638281175,
          "store_id": 4,
          "role_name": "Voter"
        },
        {
          "id": 638281176,
          "store_id": 5,
          "role_name": "Voter"
        },
        {
          "id": 638281177,
          "store_id": 2751139,
          "role": 1,
          "role_name": "Learner",
          "is_learner": true
        }
      ],
      "leader": {
        "id": 638281176,
        "store_id": 5,
        "role_name": "Voter"
      },
      "pending_peers": [
        {
          "id": 638281174,
          "store_id": 1,
          "role_name": "Voter"
        },
        {
          "id": 638281175,
          "store_id": 4,
          "role_name": "Voter"
        },
        {
          "id": 638281177,
          "store_id": 2751139,
          "role": 1,
          "role_name": "Learner",
          "is_learner": true
        }
      ]
    },
    {
      "id": 614447770,
      "epoch": {
        "conf_ver": 6,
        "version": 109418
      },
      "peers": [
        {
          "id": 614447771,
          "store_id": 1,
          "role_name": "Voter"
        },
        {
          "id": 614447772,
          "store_id": 4,
          "role_name": "Voter"
        },
        {
          "id": 614447773,
          "store_id": 5,
          "role_name": "Voter"
        },
        {
          "id": 614447774,
          "store_id": 2751139,
          "role": 1,
          "role_name": "Learner",
          "is_learner": true
        }
      ],
      "leader": {
        "id": 614447773,
        "store_id": 5,
        "role_name": "Voter"
      },
      "pending_peers": [
        {
          "id": 614447771,
          "store_id": 1,
          "role_name": "Voter"
        },
        {
          "id": 614447772,
          "store_id": 4,
          "role_name": "Voter"
        },
        {
          "id": 614447774,
          "store_id": 2751139,
          "role": 1,
          "role_name": "Learner",
          "is_learner": true
        }
      ]
    }
  ]
}

and Output of get region by id

{
  "id": 55929554,
  "epoch": {
    "conf_ver": 6,
    "version": 109399
  },
  "peers": [
    {
      "id": 55929555,
      "store_id": 1,
      "role_name": "Voter"
    },
    {
      "id": 55929556,
      "store_id": 4,
      "role_name": "Voter"
    },
    {
      "id": 55929557,
      "store_id": 5,
      "role_name": "Voter"
    },
    {
      "id": 55929558,
      "store_id": 2751139,
      "role": 1,
      "role_name": "Learner",
      "is_learner": true
    }
  ],
  "leader": {
    "id": 55929555,
    "store_id": 1,
    "role_name": "Voter"
  },
  "down_peers": [
    {
      "down_seconds": 40307,
      "peer": {
        "id": 55929556,
        "store_id": 4,
        "role_name": "Voter"
      }
    }
  ],
  "pending_peers": [
    {
      "id": 55929556,
      "store_id": 4,
      "role_name": "Voter"
    }
  ]
}

What version of PD are you using (pd-server -V)?

ti-chi-bot bot pushed a commit that referenced this issue Jul 17, 2023
…6804)

close #6560

Instead of maintaining its own region info cache, use the core cluster to
fetch the region info inside `RegionStatistics` to make sure consistency.

Signed-off-by: JmPotato <[email protected]>
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jul 17, 2023
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jul 17, 2023
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jul 17, 2023
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jul 17, 2023
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this issue Jul 17, 2023
@nolouch nolouch added affects-6.1 This bug affects the 6.1.x(LTS) versions. and removed affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. labels Jul 19, 2023
rleungx pushed a commit to rleungx/pd that referenced this issue Dec 1, 2023
…ikv#6804)

close tikv#6560

Instead of maintaining its own region info cache, use the core cluster to
fetch the region info inside `RegionStatistics` to make sure consistency.

Signed-off-by: JmPotato <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants