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

server/api: fix the issue about regions/check API #1311

Merged
merged 4 commits into from
Nov 7, 2018

Conversation

nolouch
Copy link
Contributor

@nolouch nolouch commented Nov 6, 2018

What problem does this PR solve?

related #1297, the region check command show {} for each region. like:

[
    {},
    {},
]

What is changed and how it works?

use the regionsInfo struct in api to response the request.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
    region check down-peer
{
  "count": 1,
  "regions": [
    {
      "id": 2,
      "start_key": "a",
      "end_key": "b",
      "epoch": {
        "conf_ver": 1,
        "version": 1
      },
      "peers": [
        {
          "id": 2,
          "store_id": 1
        },
        {
          "id": 13,
          "store_id": 2
        }
      ],
      "leader": {
        "id": 2,
        "store_id": 1
      },
      "down_peers": [
        {
          "peer": {
            "id": 13,
            "store_id": 2
          },
          "down_seconds": 3600
        }
      ],
      "pending_peers": [
        {
          "id": 13,
          "store_id": 2
        }
      ],
      "approximate_size": 10,
      "approximate_keys": 10
    }
  ]
}

@nolouch nolouch requested review from disksing and rleungx and removed request for disksing November 6, 2018 12:04
@nolouch nolouch added the component/api HTTP API. label Nov 6, 2018
Count: len(regions),
Regions: regionInfos,
}
res := convertToAPIRegions(regions)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regionsInfo?

err = readJSONWithURL(url, r3)
c.Assert(err, IsNil)
c.Assert(r3, DeepEquals, &regionsInfo{Count: 1, Regions: []*regionInfo{newRegionInfo(r)}})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line

@@ -19,6 +19,8 @@ import (
"net/url"
"sort"

"github.com/pingcap/kvproto/pkg/pdpb"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line?

@disksing disksing merged commit aa57c78 into tikv:master Nov 7, 2018
@nolouch nolouch added the needs-cherry-pick-release-2.1 The PR needs to cherry pick to release-2.1 branch. label Nov 8, 2018
nolouch added a commit to nolouch/pd that referenced this pull request Nov 8, 2018
* server/api: fix region check API interface
nolouch added a commit to nolouch/pd that referenced this pull request Nov 8, 2018
* server/api: fix region check API interface
rleungx pushed a commit to rleungx/pd that referenced this pull request Nov 12, 2018
* server/api: fix region check API interface
@nolouch nolouch added the needs-cherry-pick-release-2.0 The PR needs to cherry pick to release-2.0 branch. label Nov 13, 2018
disksing pushed a commit to oh-my-tidb/pd that referenced this pull request Nov 14, 2018
disksing added a commit that referenced this pull request Nov 14, 2018
* server, client: fix hanging problem when etcd failed to start (#1267)

* server: use same initialcluster config to restart joined member (#1279)

* fix server build

* pdctl: cherry pick bugfixes (#1298, #1299, #1308)

* server/api: fix the issue about `regions/check` API (#1311)

* fix join build

* fix pdctl build

* fix region test

* fix warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/api HTTP API. needs-cherry-pick-release-2.0 The PR needs to cherry pick to release-2.0 branch. needs-cherry-pick-release-2.1 The PR needs to cherry pick to release-2.1 branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants