Skip to content
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

mcs: remove wait api service ready #8476

Merged
merged 6 commits into from
Aug 12, 2024
Merged

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Aug 1, 2024

What problem does this PR solve?

Issue Number: ref #8477

What is changed and how does it work?

To support dynamically switching TSO, we must utilize the service discovery to decide who is responsible for serving TSO requests. However, the current implementation will register the TSO service until the API server is ready to serve. So there must be at least one switch when we use ms mode to start the cluster.

Check List

Tests

  • Unit test

Release note

None.

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/needs-linked-issue labels Aug 1, 2024
return s.startServer()
}

func (s *Server) Register() error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these Register are similar, could we merge them?

@@ -103,21 +105,49 @@ func (s *Server) SetLogLevel(level string) error {

// Run runs the Resource Manager server.
func (s *Server) Run() (err error) {
skipWaitAPIServiceReady := false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will removing affect serverless? I am not sure either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InitClusterID now will retry until the etcd can provide the service.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 2, 2024
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 5, 2024
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.41%. Comparing base (3f32f54) to head (059b18e).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #8476    +/-   ##
========================================
  Coverage   77.40%   77.41%            
========================================
  Files         472      472            
  Lines       61821    61515   -306     
========================================
- Hits        47854    47620   -234     
+ Misses      10400    10360    -40     
+ Partials     3567     3535    -32     

@@ -34,7 +34,7 @@ import (
"github.com/tikv/pd/pkg/cache"
"github.com/tikv/pd/pkg/core/constant"
"github.com/tikv/pd/pkg/core/storelimit"
"github.com/tikv/pd/pkg/mcs/utils"
mcsconstat "github.com/tikv/pd/pkg/mcs/utils/constant"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
mcsconstat "github.com/tikv/pd/pkg/mcs/utils/constant"
mcsconstant "github.com/tikv/pd/pkg/mcs/utils/constant"

@@ -113,9 +113,7 @@ func (suite *serverRegisterTestSuite) checkServerRegister(serviceName string) {
}

func (suite *serverRegisterTestSuite) TestServerPrimaryChange() {
suite.checkServerPrimaryChange(utils.TSOServiceName, 3)
// TODO: uncomment after resource-manager is ready
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

return clusterID, nil
}
select {
case <-ctx.Done():
return 0, err
case <-ticker.C:
retryTimes++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will print the log every 250s until it succeeds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as previous

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 6, 2024
@rleungx rleungx requested a review from JmPotato August 6, 2024 07:34
}
if err := utils.InitClient(s); err != nil {

// register
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a meaningless comment. We can remove it

}

if err := utils.InitClient(s); err != nil {
// register
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -100,6 +100,11 @@ func (bs *BaseServer) SetETCDClient(etcdClient *clientv3.Client) {
bs.etcdClient = etcdClient
}

// SetETCDClient sets the etcd client.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Suggested change
// SetETCDClient sets the etcd client.
// GetETCDClient gets the etcd client.

return err
}

// register
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -330,6 +278,41 @@ func StopGRPCServer(s server) {
}
}

func Register(s server, serviceName string) (uint64, *discovery.ServiceRegistryEntry, *discovery.ServiceRegister, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some comments for it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the content in the file is related to the server. Maybe we can rename the file, or later move the server-related parts to server.go.

Copy link
Member

@okJiang okJiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the conflict

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 7, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 7, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-06 06:11:00.69259285 +0000 UTC m=+332390.559691939: ☑️ agreed by lhy1024.
  • 2024-08-07 02:35:06.241581064 +0000 UTC m=+405836.108680149: ☑️ agreed by okJiang.

@rleungx
Copy link
Member Author

rleungx commented Aug 7, 2024

/cc @niubell

Copy link
Contributor

ti-chi-bot bot commented Aug 7, 2024

@rleungx: GitHub didn't allow me to request PR reviews from the following users: niubell.

Note that only tikv members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @niubell

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 kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 10, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2024
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2024
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JmPotato, lhy1024, niubell, okJiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Aug 12, 2024
@ti-chi-bot ti-chi-bot bot merged commit f3602e3 into tikv:master Aug 12, 2024
25 checks passed
@rleungx rleungx deleted the remove-wait-api branch August 12, 2024 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants