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: handle partitioned table in some http APIs #11463

Merged
merged 4 commits into from
Jul 26, 2019

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

mysql> create table xx (a int) partition by range (a) 
    -> (partition p0 values less than (255),
    -> partition p1 values less than (65535),
    -> partition p2 values less than (100000));
Query OK, 0 rows affected (0.16 sec)

Visit the HTTP API http://localhost:10080/tables/test/xx/regions

Before:

{
 "name": "xx",
 "id": 43,
 "record_regions": [
  {
   "region_id": 42,
   "leader": {
    "id": 43,
    "store_id": 1
   },
   "peers": [
    {
     "id": 43,
     "store_id": 1
    }
   ],
   "region_epoch": {
    "conf_ver": 1,
    "version": 21
   }
  }
 ],
 "indices": []
}

After:

[
 {
  "name": "p0",
  "id": 44,
  "record_regions": [
   {
    "region_id": 44,
    "leader": {
     "id": 45,
     "store_id": 1
    },
    "peers": [
     {
      "id": 45,
      "store_id": 1
     }
    ],
    "region_epoch": {
     "conf_ver": 1,
     "version": 22
    }
   }
  ],
  "indices": []
 },
 {
  "name": "p1",
  "id": 45,
  "record_regions": [
   {
    "region_id": 46,
    "leader": {
     "id": 47,
     "store_id": 1
    },
    "peers": [
     {
      "id": 47,
      "store_id": 1
     }
    ],
    "region_epoch": {
     "conf_ver": 1,
     "version": 23
    }
   }
  ],
  "indices": []
 },
 {
  "name": "p2",
  "id": 46,
  "record_regions": [
   {
    "region_id": 2,
    "leader": {
     "id": 3,
     "store_id": 1
    },
    "peers": [
     {
      "id": 3,
      "store_id": 1
     }
    ],
    "region_epoch": {
     "conf_ver": 1,
     "version": 23
    }
   }
  ],
  "indices": []
 }
]

And the HTTP API http://localhost:10080/regions/44

Before:

{
 "region_id": 44,
 "start_key": "dIAAAAAAAAAs",
 "end_key": "dIAAAAAAAAAt",
 "frames": null
}

After:

{
 "region_id": 44,
 "start_key": "dIAAAAAAAAAs",
 "end_key": "dIAAAAAAAAAt",
 "frames": [
  {
   "db_name": "test",
   "table_name": "xx(p0)",
   "table_id": 44,
   "is_record": true
  }
 ]
}

What is changed and how it works?

Now the following two http endpoint supports partitioned table:

  • /tables/{db}/{table}/regions
  • /regions/{regionID}

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Related changes

  • Need to cherry-pick to the release branch

Now the following two http endpoint supports partitioned table:
  /tables/{db}/{table}/regions
  /regions/{regionID}
@tiancaiamao
Copy link
Contributor Author

PTAL @jackysp @lysu

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu lysu added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 26, 2019
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 26, 2019
@jackysp jackysp added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 26, 2019
@zz-jason zz-jason removed the status/LGT1 Indicates that a PR has LGTM 1. label Jul 26, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Jul 26, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Jul 26, 2019

@tiancaiamao merge failed.

@codecov
Copy link

codecov bot commented Jul 26, 2019

Codecov Report

Merging #11463 into master will increase coverage by 0.184%.
The diff coverage is n/a.

@@               Coverage Diff               @@
##             master     #11463       +/-   ##
===============================================
+ Coverage   81.3575%   81.5416%   +0.184%     
===============================================
  Files           424        424               
  Lines         90857      91736      +879     
===============================================
+ Hits          73919      74803      +884     
+ Misses        11623      11619        -4     
+ Partials       5315       5314        -1

@zz-jason
Copy link
Member

/run-integration-common-test
/run-common-test

@sre-bot
Copy link
Contributor

sre-bot commented Jul 26, 2019

cherry pick to release-3.0 in PR #11466

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants