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

*: move tso to independent thread #8720

Merged
merged 11 commits into from
Oct 22, 2024
Merged

*: move tso to independent thread #8720

merged 11 commits into from
Oct 22, 2024

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Oct 16, 2024

What problem does this PR solve?

Issue Number: Ref #8477.

What is changed and how does it work?

This is a part of #8517.

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. labels Oct 16, 2024
client/client.go Outdated
@@ -203,7 +203,9 @@ func (k *serviceModeKeeper) close() {
defer k.Unlock()
switch k.serviceMode {
case pdpb.ServiceMode_API_SVC_MODE:
k.tsoSvcDiscovery.Close()
if k.tsoSvcDiscovery != nil {
Copy link
Member

Choose a reason for hiding this comment

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

What about moving this check into Close()?

@@ -390,25 +400,85 @@ func (c *RaftCluster) checkServices() {
}
}

// checkTSOService checks the TSO service.
func (c *RaftCluster) checkTSOService() {
if !c.isAPIServiceMode {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if !c.isAPIServiceMode {
if c.isAPIServiceMode {
return
}

if !c.isAPIServiceMode {
if c.member.IsLeader() {
if err := c.startTSOJobs(); err != nil {
// If there is an error, need to wait for the next check.
Copy link
Member

Choose a reason for hiding this comment

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

Do we need log here?

} else {
// leader exits, reset the allocator group
if err := c.stopTSOJobs(); err != nil {
// If there is an error, need to wait for the next check.
Copy link
Member

Choose a reason for hiding this comment

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

Ditto.

@rleungx
Copy link
Member Author

rleungx commented Oct 17, 2024

/retest

@@ -314,11 +322,13 @@ func (c *RaftCluster) Start(s Server) error {
if err != nil {
return err
}
c.checkTSOService()
Copy link
Member

Choose a reason for hiding this comment

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

Can we put this func next to checkSchedulingService?

Copy link
Member Author

@rleungx rleungx Oct 21, 2024

Choose a reason for hiding this comment

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

prefer to check it ASAP

@@ -1715,29 +1714,6 @@ func (s *Server) campaignLeader() {
s.member.KeepLeader(ctx)
log.Info(fmt.Sprintf("campaign %s leader ok", s.mode), zap.String("campaign-leader-name", s.Name()))

if !s.IsAPIServiceMode() {
Copy link
Member

@okJiang okJiang Oct 17, 2024

Choose a reason for hiding this comment

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

Need we remove the comments? L1714, L1703-L1706

Copy link
Member Author

Choose a reason for hiding this comment

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

it still works

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.

rest lgtm

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]>
Signed-off-by: Ryan Leung <[email protected]>
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 49.18033% with 31 lines in your changes missing coverage. Please review.

Project coverage is 69.94%. Comparing base (25629f2) to head (1bbc97f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8720      +/-   ##
==========================================
- Coverage   69.97%   69.94%   -0.04%     
==========================================
  Files         517      517              
  Lines       79953    79983      +30     
==========================================
- Hits        55947    55941       -6     
- Misses      20429    20472      +43     
+ Partials     3577     3570       -7     
Flag Coverage Δ
unittests 69.94% <49.18%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@rleungx
Copy link
Member Author

rleungx commented Oct 21, 2024

/retest

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 21, 2024
Signed-off-by: Ryan Leung <[email protected]>
@rleungx
Copy link
Member Author

rleungx commented Oct 21, 2024

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2024
Signed-off-by: Ryan Leung <[email protected]>
@rleungx
Copy link
Member Author

rleungx commented Oct 21, 2024

/hold cancel

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2024
Signed-off-by: Ryan Leung <[email protected]>
@@ -390,25 +400,76 @@ func (c *RaftCluster) checkServices() {
}
}

// checkTSOService checks the TSO service.
func (c *RaftCluster) checkTSOService() {
Copy link
Member

Choose a reason for hiding this comment

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

Seems we do not need this wrap function now. We can call startTSOJobs directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

for the upcomming PR

@ti-chi-bot ti-chi-bot bot added the lgtm label Oct 22, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nolouch, 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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 22, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 22, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-21 07:46:27.818714314 +0000 UTC m=+250788.515504925: ☑️ agreed by nolouch.
  • 2024-10-22 06:32:31.898409369 +0000 UTC m=+332752.595199978: ☑️ agreed by okJiang.

Copy link
Contributor

ti-chi-bot bot commented Oct 22, 2024

@rleungx: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-integration-realcluster-test 1bbc97f link false /test pull-integration-realcluster-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot merged commit 0402e15 into tikv:master Oct 22, 2024
21 of 25 checks passed
@rleungx rleungx deleted the check-loop branch October 22, 2024 07:14
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants