-
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
vtctldclient,grpcvtctldserver ApplySchema: return unknown params from grpcvtctldserver.ApplySchema, log them in vtctldclient.ApplySchema #14672
Conversation
… grpcvtctldserver.ApplySchema, log them in vtctldclient.ApplySchema Signed-off-by: Max Englander <max@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
|
Signed-off-by: Max Englander <max@planetscale.com>
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.
lgtm
proto/vtctldata.proto
Outdated
@@ -374,6 +374,11 @@ message ApplyVSchemaRequest { | |||
|
|||
message ApplyVSchemaResponse { | |||
vschema.Keyspace v_schema = 1; | |||
map<string, ParamList> vindex_unknown_params = 2; |
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.
naming nit: let's call this type UnknownVindexParams and the field accordingly
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.
For what it's worth we call it VindexUnknownParameters
, elsewhere but I will make the change
grep -R "VindexUnknown" go
go/vt/vtgate/vtgate_test.go:func TestVSchemaVindexUnknownParams(t *testing.T) {
go/vt/vtgate/vtgate.go: vindexUnknownParams = stats.NewGauge("VindexUnknownParameters", "Number of parameterss unrecognized by Vindexes")
go/vt/vtgate/executor.go: unknownParams += ks.VindexUnknownParamsCount
go/vt/vtgate/vschema_stats.go: VindexUnknownParamsCount int
go/vt/vtgate/vschema_stats.go: s.VindexUnknownParamsCount += len(pv.UnknownParams())
go/vt/vtgate/vschema_stats.go: <td>{{$ks.VindexUnknownParamsCount}}</td>
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.
ah i didn't realize that (i would have voted against that name too haha) sorry!
Co-authored-by: Andrew Mason <amason@hey.com> Signed-off-by: Max Englander <max.englander@gmail.com>
Signed-off-by: Max Englander <max@planetscale.com>
349776c
to
ed28671
Compare
@@ -374,6 +374,11 @@ message ApplyVSchemaRequest { | |||
|
|||
message ApplyVSchemaResponse { | |||
vschema.Keyspace v_schema = 1; | |||
map<string, ParamList> unknown_vindex_params = 2; |
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.
Can you please add a comment to this field (UnknownVindexParams is ...
) and can you please explain the format/structure here? I'm not sure I understand what in this map[string]([]string)
.
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.
Added a comment in 5e4fa13
In terms of what goes in here. The VSchema allows you defined params
on Vindexes in the form of map[string]string
. This makes it very easy for users to put in parameters that aren't recognized, e.g. due to typos. Until relatively recently, Vitess would happily accept unknown vindex params, and not report it as an issue. Vitess now has the internal ability to track and report unknown params. However, vtctld
has not yet caught up.
This PR addresses that by adding a map[string, ParamList]
field to the ApplyVSchema
gRPC response. This contents will map the name(s) of user-defined vindex(es) to the names of any unknown params found in the params
block of those vindexes. The somewhat awkward way of defining a "map to a list of strings" here is due to limitations in protobuf.
Signed-off-by: Max Englander <max@planetscale.com>
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.
LGTM. Thanks, @maxenglander !
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Signed-off-by: Max Englander <max.englander@gmail.com>
Signed-off-by: Max Englander <max@planetscale.com>
Description
#12476 modified
vtctl ApplyVSchema
to log unknown vindex params. This makes an equivalent change tovtctld.ApplyVSchema
.vtctld
returnsVindexUnknownParams
in theApplyVSchema
GRPC response.vtctldclient
will print them out like this:Note that this changes the
DryRun
behavior a little bit.DryRun
will now return an error ifvindexes.BuildKeyspace
fails to process the supplied VSchema body (e.g. if an invalid vindex type supplied).Related Issue(s)
Checklist
"Backport to:" labels have been added ifthis change should not be back-portedwas added oris not required