-
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
refac: Refactor Server.GetWorkflows()
#17092
refac: Refactor Server.GetWorkflows()
#17092
Conversation
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
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17092 +/- ##
==========================================
+ Coverage 67.33% 67.44% +0.11%
==========================================
Files 1569 1575 +6
Lines 252506 253252 +746
==========================================
+ Hits 170021 170809 +788
+ Misses 82485 82443 -42 ☔ 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]>
Signed-off-by: Noble Mittal <[email protected]>
Can you give the test coverage before and after? |
Here's the coverage on main:
and, here's the coverage on this branch:
I used this cmd to generate the coverage report because go test ./go/vt/vttablet/tabletmanager ./go/vt/vtctl/workflow -coverpkg=vitess.io/vitess/go/vt/vtctl/workflow... -coverprofile=c.out |
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.
Nice work.
As a follow-up PR let's check the unit test coverage of workflows.go
and add more unit tests if there are parts of the code in that file which are not covered.
limitations under the License. | ||
*/ | ||
|
||
package workflow |
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 have not done this in the past, but can you please write a top-level comment for what this file contains?
@rohit-nayak-ps you might need to help with that.
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.
Done. Please have a look.
Signed-off-by: Noble Mittal <[email protected]>
Signed-off-by: Rohit Nayak <[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. Just had the one nit that you can handle as you feel best. Thanks!
go/vt/vtctl/workflow/server.go
Outdated
readReq := &tabletmanagerdatapb.ReadVReplicationWorkflowsRequest{} | ||
if req.Workflow != "" { | ||
readReq.IncludeWorkflows = []string{req.Workflow} | ||
w := &workflow{ |
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, but IMO a better name for this struct/type would be workflowReader
or workflowFetcher
. The term workflow[s]
is already so overloaded today in the code.
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.
done.
fetchLogsWG.Wait() | ||
} | ||
|
||
return maps.Values(workflowsMap), nil |
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.
It might be worth sorting the slice here by keyspace/workflowName. Can be done later.
Signed-off-by: Noble Mittal <[email protected]>
Description
GetWorkflows()
monolithic function into utility functions inworkflows.go
fetchCopyStatesByShardStream
,WorkflowStatus
,getWorkflowCopyStates
)Related Issue(s)
Checklist
Deployment Notes