-
Notifications
You must be signed in to change notification settings - Fork 721
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
resource_manager: add service mode server #5994
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Skipping CI for Draft Pull Request. |
Codecov ReportBase: 75.03% // Head: 74.77% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #5994 +/- ##
==========================================
- Coverage 75.03% 74.77% -0.26%
==========================================
Files 363 365 +2
Lines 36339 36552 +213
==========================================
+ Hits 27266 27331 +65
- Misses 6687 6820 +133
- Partials 2386 2401 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Could you please add some simple tests to validate it works? |
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
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.
left some comments
} | ||
// Server has started. | ||
atomic.StoreInt64(&s.isServing, 1) | ||
return mux.Serve() |
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.
if mux.Serve is a blocking call, we might have a bigger issue. It means it won't stay on <-ctx.Done to wait for the exit signals. if a signal is raised, svr.Run() won't return unless network listener is closed but it mightn't.
var sig os.Signal
go func() {
sig = <-sc
cancel()
}()
if err := svr.Run(); err != nil {
log.Fatal("run server failed", errs.ZapError(err))
}
<-ctx.Done()
} | ||
|
||
s.grpcServer = grpc.NewServer() | ||
s.service.RegisterGRPCService(s.grpcServer) |
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 seems that we should support gPRC Gateway. By default, EnableGRPCGateway is true.
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.
where will we use it?
} | ||
// Server has started. | ||
atomic.StoreInt64(&s.isServing, 1) | ||
return mux.Serve() |
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.
In this commit 3f050d1, I refactored GRPC and HTTP Server start logic. It refers to DGraph https://github.com/binshi-bing/dgraph/blob/cbec2309413a9b17d407b3417300f719381b36d7/dgraph/cmd/zero/run.go#L318-L319 and cmux example https://github.com/soheilhy/cmux/blob/5ec6847320e53b5fee0ab9a4757b56625a946c85/example/example_test.go#L108.
Signed-off-by: lhy1024 <admin@liudos.us>
BackendEndpoints string `toml:"backend-endpoints" json:"backend-endpoints"` | ||
ListenAddr string `toml:"listen-addr" json:"listen-addr"` | ||
Name string `toml:"name" json:"name"` | ||
DataDir string `toml:"data-dir" json:"data-dir"` |
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.
What is DataDir
used for?
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.
L162 log path?
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.
Log.File.Filename does the same thing?
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 will do in another pr
s.service.RegisterGRPCService(gs) | ||
err := gs.Serve(l) | ||
if err != cmux.ErrListenerClosed { | ||
log.Fatal("grpc server stops serving unexpectedly.", errs.ZapError(err)) |
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.
log.Fatal("grpc server stops serving unexpectedly.", errs.ZapError(err)) | |
log.Fatal("grpc server stops serving unexpectedly", errs.ZapError(err)) |
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.
Suggest removing all periods in log
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
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
@binshi-bing: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Signed-off-by: lhy1024 <admin@liudos.us>
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
@binshi-bing: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
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.
The rest LGTM
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
/merge |
@lhy1024: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: a94eaab
|
ref tikv#5837 Signed-off-by: lhy1024 <admin@liudos.us> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> Conflicts: go.mod pkg/mcs/tso/server/server.go tests/client/go.sum tests/mcs/go.sum
What problem does this PR solve?
Issue Number: Ref #5837
What is changed and how does it work?
Check List
Tests
./bin/pd-server service resource_manager --backend-endpoints="http://127.0.0.1:35207"
Release note