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

using PD's ScanRegions API #959

Open
marsishandsome opened this issue Jul 30, 2019 · 0 comments
Open

using PD's ScanRegions API #959

marsishandsome opened this issue Jul 30, 2019 · 0 comments
Assignees

Comments

@marsishandsome
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

currently tispark use the following api to get region info

public static List<TiRegion> getRegionsByTable(TiSession session, TiTableInfo table) {
    ArrayList<TiRegion> regionList = new ArrayList<>();
    Key key = RowKey.createMin(table.getId());
    RowKey endRowKey = RowKey.createBeyondMax(table.getId());

    while (key.compareTo(endRowKey) < 0) {
      TiRegion region = session.getRegionManager().getRegionByKey(key.toByteString());
      regionList.add(region);
      key = Key.toRawKey(region.getEndKey());
    }
    return regionList;
  }

it's better to use ScanRegions API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants