-
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
Refactor Server.LookupVindexCreate
#17242
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[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
|
LookupVindexCreate
Server.LookupVindexCreate
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17242 +/- ##
==========================================
+ Coverage 67.52% 67.60% +0.07%
==========================================
Files 1581 1582 +1
Lines 253948 253985 +37
==========================================
+ Hits 171480 171706 +226
+ Misses 82468 82279 -189 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
go/vt/vtctl/workflow/lookup.go
Outdated
) | ||
|
||
// lookup is responsible for performing actions related to lookup vindexes. | ||
type lookup struct { |
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 is a new struct that has a subset of the workflow server's values, and it's not specific to lookup vindexes at all. Can you help me understand what value this provides?
The workflow server type being:
type Server struct {
ts *topo.Server
tmc tmclient.TabletManagerClient
// Limit the number of concurrent background goroutines if needed.
sem *semaphore.Weighted
env *vtenv.Environment
options serverOptions
}
Otherwise this LGTM. Thanks!
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.
Sure, the idea for defining lookup
struct was to differentiate the helper functions related to LookupVindex
from Server
(as of now lookup
just differentiates LookupVindexCreate
helper functions in this PR), this is similar to what was done in #17092 by defining workflowFetcher
. We can always include more functions (related to lookup vindexes) in follow-ups. Please let me know if you think this can be improved further. Thanks for the review!
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.
OK, so I take that to mean this is really for a human reader/developer to try and make the code easier to reason about and manage as lookup vindex related workflow code is in its own specific file and has its own specific method receiver.
In that case, IMO we should do this:
- Go from workflow/lookup.go to workflow/lookup_vindex.go
- Go from workflow.lookup.prepareCreateLookup to workflow.lookupVindex.prepareCreate (the type becomes lookupVindex and we don't need that lookupvindex context in the function name as its encapsulated in the receiver type
Lookup is a very generic term and it's not otherwise obvious to me how it adds distinction, separation, discoverability, and clarity specifically around the VReplication backfilling work for Lookup Vindexes via the LookupVindex client command and related RPCs. A lookup vindex is a specific concept in Vitess, and the client command we're processing in the workflow server is LookupVindex
(also here and here). Otherwise I would think that workflow/lookup was about code related to looking up workflows. Does this all make sense?
Thanks!
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.
that does make a lot of sense, improves the readability. thank you so much @mattlord!
pushed the changes, please have a look.
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Noble Mittal <[email protected]>
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 again, @beingnoble03 !
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc" | ||
) | ||
|
||
// lookup is responsible for performing actions related to lookup vindexes. |
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.
Nit, we didn't update the struct name in the comment.
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.
Oh sorry! Pushed the change now.
Signed-off-by: Noble Mittal <[email protected]>
Description
This PR is based on #17092. Mainly refactors
prepareCreateLookup()
.Related Issue(s)
Checklist
Deployment Notes