-
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
Allow specifying the hashing method for CreateLookupVindex #14157
Conversation
This change allows specifying the vschema fragment to override the hashing used for the backup table for the lookup vindex. This is something someone can manually already modify / set up in the vschema, but CreateLookupVindex does not support this properly. Signed-off-by: Dirkjan Bussink <[email protected]>
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
|
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.
Thanks, @dbussink ! Overall this LGTM and makes sense. Just a couple of minor things.
I'm working on the vtctldclient
implementation here (was about to mark it as ready for review): #14086
I can add the same support there.
We should update the e2e test to include the lookup vindex's target table primary vindex definition too. I can do that in my PR.
@@ -741,16 +759,22 @@ func (wr *Wrangler) prepareCreateLookup(ctx context.Context, keyspace string, sp | |||
materializeQuery = buf.String() | |||
|
|||
// Update targetVSchema | |||
var targetTable *vschemapb.Table | |||
targetTable := specs.Tables[targetTableName].CloneVT() |
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.
Why do a clone here?
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.
Wanted to make sure it doesn’t end up modifying the original here from the user input.
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 don't change it though. And I feel like if we do change it, that might be what we want? I don't know why we'd want them to differ off the top of my head. I was gong to skip this part in the vtctldclient implementation.
} | ||
// Loop executes once. | ||
|
||
// Loop executes once or twice | ||
for k, ti := range specs.Tables { | ||
if len(ti.ColumnVindexes) != 1 { | ||
return nil, nil, nil, fmt.Errorf("exactly one ColumnVindex must be specified for the table: %v", specs.Tables) |
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 now instead specify the actual table name here rather than the spec.
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.
You mean in the error message?
vindexCols = ti.ColumnVindexes[0].Columns | ||
} else { | ||
if ti.ColumnVindexes[0].Column == "" { | ||
return nil, nil, nil, fmt.Errorf("at least one column must be specified in ColumnVindexes: %v", sourceTable.ColumnVindexes) |
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.
This should be using ti.ColumnVindexes in the error.
I have added two labels
|
After talking with Harshit, I think I'm going to make the default for Since we're going to be updating the summary in this PR anyway, should we change the vtctlclient default here as well @harshit-gangal ? |
This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:
If no action is taken within 7 days, this PR will be closed. |
This PR was closed because it has been stale for 7 days with no activity. |
This change allows specifying the vschema fragment to override the hashing used for the backup table for the lookup vindex. This is something someone can manually already modify / set up in the vschema, but CreateLookupVindex does not support this properly.
Related Issue(s)
Fixes #14155
Checklist