Conversation
ajm188
left a comment
There was a problem hiding this comment.
Almost there, I think. I think the current refactor makes the ValidateSchemaShard a little overloaded, and pulling out the vschema validation to its own function will make this a bit clearer.
go/vt/vtctl/vtctl.go
Outdated
There was a problem hiding this comment.
We should add a flag to this command (and probably ValidateSchemaShard, sorry for not pointing that out earlier) to be able to pass true through here.
499c991 to
5d90c86
Compare
ajm188
left a comment
There was a problem hiding this comment.
Everything I have is pretty minor changes; I think Rafa was saying he had other thoughts so we should wait for him as well.
go/vt/vtctl/vtctl.go
Outdated
go/vt/wrangler/schema.go
Outdated
There was a problem hiding this comment.
You shouldn't need to pass a reference to the recorder here; it's in scope in the closure of the goroutine (similar to how you're using the wait group).
There was a problem hiding this comment.
I actually got linting errors when I did not pass in the recorder or shard which is why I passed them in
Linting go/vt/wrangler
go/vt/wrangler/schema.go:289:45: loopclosure: loop variable shard captured by func literal (govet)
si, err := wr.ts.GetShard(ctx, keyspace, shard)
^
go/vt/wrangler/schema.go:291:83: loopclosure: loop variable shard captured by func literal (govet)
shardFailures.RecordError(fmt.Errorf("GetShard(%v, %v) failed: %v", keyspace, shard, err))
^
go/vt/wrangler/schema.go:297:45: loopclosure: loop variable shard captured by func literal (govet)
excludeTables, includeViews, keyspace, shard, err,
^
There was a problem hiding this comment.
Those lint errors are complaining about the shard variable specifically (which is a correct error). I'm talking about just the shardFailures variable which isn't part of the range loop.
To illustrate what the linter is warning about, check out the difference between these two loops: https://play.golang.org/p/eQtSzSI60lR
go/vt/wrangler/schema.go
Outdated
There was a problem hiding this comment.
This is unused currently but thought that this functionality may be needed at some point. Instead of requiring the caller to pass in all shard names to ValidateVSchema we can use this. In the two instances in which I've seen us validate the vschema we also have had the shards we are trying to validate so I understand if we should remove this.
There was a problem hiding this comment.
Yeah I think if we don't need it now (and we don't expect to immediately need it in the short-term), then we should hold off. We can always add it back later!
go/vt/wrangler/schema.go
Outdated
59e4a05 to
3c847b2
Compare
Signed-off-by: Malcolm Akinje <makinje@slack-corp.com>
3c847b2 to
3479947
Compare
rafael
left a comment
There was a problem hiding this comment.
Thank you for addressing all the comments. This looks good to me.
ajm188
left a comment
There was a problem hiding this comment.
looks good to me! thanks Malcolm ❤️
Signed-off-by: Malcolm Akinje makinje@slack-corp.com
Description
This PR adds in
ValidateVSchema.ValidateSchemaShardnow uses this method as a helper whenincludeVSchemais provided to it. This also gives the oppourtunity to validate that a shards schema is equivalent to the vschema in other areas besides the aforementioned method like when we create a resharding workflow.Related Issue(s)
Checklist
Deployment Notes