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

Create Region JSON Vindex #5806

Merged
merged 19 commits into from Mar 20, 2020
Merged

Create Region JSON Vindex #5806

merged 19 commits into from Mar 20, 2020

Conversation

RyanLeonardSpruce
Copy link
Contributor

Adds the region_vindex (as region_json) created for a Vitess conference demo (https://github.com/planetscale/vitess/blob/ds-kcn19-demo/go/vt/vtgate/vindexes/region_vindex.go), with modifications so it works with the latest Vitess version.

Copy link
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

Couple of nits.

@deepthi can you also take a look?

go/vt/vtgate/vindexes/region_json.go Outdated Show resolved Hide resolved
go/vt/vtgate/vindexes/region_json.go Outdated Show resolved Hide resolved
@sougou sougou requested a review from deepthi February 7, 2020 18:07
Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

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

It will be nice to come up with an alternative to JSON, but I understand that is not the scope of this PR.

go/vt/vtgate/vindexes/region_json.go Outdated Show resolved Hide resolved
go/vt/vtgate/vindexes/region_json.go Outdated Show resolved Hide resolved
go/vt/vtgate/vindexes/region_json.go Show resolved Hide resolved
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
…mental

Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
…nction."

This reverts commit da1853d9a1ac0da9aec2c47884b80b8d57a53c2d.

Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Signed-off-by: Ryan Leonard <rleonard@spruce.com>
Copy link
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

Change is good. There's one minor nit.

// RegionMap is used to store mapping of country to region
type RegionMap map[string]uint64

// RegionJson defines a vindex that uses a lookup table.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is outdated. Looks like a copy-pasta from RegionExperimental which should also be fixed.

For RegionJson, I'd recommend:
RegionJson is a multi-column unique vindex. The first column is used to lookup the prefix part of the keyspace id, the second column is hashed, and the two values are combined to produce the keyspace id. RegionJson can be used for geo-partitioning because the first column can denote a region, and it will dictate the shard range for that region.

For RegionExperimental, it should be as above except that the first column is itself the prefix of the keyspace id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sougou I've changed the RegionJson description. Did you want me to also change the RegionExperimental description in the PR?

Copy link
Member

Choose a reason for hiding this comment

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

If you don't mind, that will be great.

Signed-off-by: Ryan Leonard <rleonard@spruce.com>
@sougou sougou merged commit 25e6fa1 into vitessio:master Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants