-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
LookupVindex: fix CLI to allow creating non-unique lookups with single column #17301
LookupVindex: fix CLI to allow creating non-unique lookups with single column #17301
Conversation
… vindexes Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17301 +/- ##
==========================================
+ Coverage 67.41% 67.49% +0.08%
==========================================
Files 1574 1577 +3
Lines 253202 253408 +206
==========================================
+ Hits 170686 171029 +343
+ Misses 82516 82379 -137 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
3dd5c4b
to
933b2bf
Compare
933b2bf
to
3dd5c4b
Compare
//err = vc.VtctldClient.ExecuteCommand("LookupVindex", "--name", vindexName, "--table-keyspace=product", "create", "--keyspace=customer", | ||
// "--type=consistent_lookup", "--table-owner=customer", "--table-owner-columns=name,cid", "--ignore-nulls", "--tablet-types=PRIMARY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed that it is documenting what we want the command to look like. Another way to do it would be to provide the vtctldclient invocation that is equivalent to this, that might be a bit less verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
create table t1( | ||
c1 int, | ||
c2 int, | ||
val varchar(128), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously a very minor nit, but the spacing is off here (maybe a mix of spaces and tabs).
tablets := make(map[string]*cluster.VttabletProcess) | ||
if _, err := vc.AddKeyspace(t, []*Cell{vc.Cells["zone1"]}, lookupClusterSpec.keyspaceName, "-80,80-", | ||
lookupClusterSpec.vschema, lookupClusterSpec.schema, defaultReplicas, defaultRdonly, 200, nil); err != nil { | ||
t.Fatal(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use require.NoError
instead as it's much easier to understand the failures (have a nice stack trace etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
tabs := setupLookupIndexKeyspace(t) | ||
_ = tabs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to use _ = setupLookupIndexKeyspace(t)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
//err = vc.VtctldClient.ExecuteCommand("LookupVindex", "--name", vindexName, "--table-keyspace=product", "create", "--keyspace=customer", | ||
// "--type=consistent_lookup", "--table-owner=customer", "--table-owner-columns=name,cid", "--ignore-nulls", "--tablet-types=PRIMARY") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed that it is documenting what we want the command to look like. Another way to do it would be to provide the vtctldclient invocation that is equivalent to this, that might be a bit less verbose.
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Description
There was an incorrect validation in
LookupIndex
that a non-unique vindex should have more than one columns. This PR removes that check.We also add a new e2e test specifically around lookup vindexes to validate this change and add a framework to test lookup vindexes more extensively in the future.
This bug has been around since the beginning, so we should backport this to supported versions.
Related Issue(s)
#17302
Checklist