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: register tso allocator #7891

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Mar 7, 2024

What problem does this PR solve?

Issue Number: ref #8477.

What is changed and how does it work?

This PR tries to avoid there are two allocators at the same time. If the TSO service has an allocator that might finish the sync timestamp. Then PD still allocates TSO, after enabling the dynamic switch, it might have a TSO fallback issue.

TSO service sync t1, PD is allocating from t2, t2 is less than t1 at the moment. But if PD syncs again and starts from t2 which is larger than t1, meanwhile TSO is not discovered immediately. The TSO might fall back.

Check List

Tests

  • Unit test

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented Mar 7, 2024

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@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. labels Mar 7, 2024
@ti-chi-bot ti-chi-bot bot requested review from disksing and nolouch March 7, 2024 05:42
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 7, 2024
@rleungx rleungx force-pushed the register-allocator branch from 5a3803a to acf9c7d Compare March 8, 2024 10:01
@rleungx rleungx requested review from JmPotato and removed request for disksing March 8, 2024 10:04
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 86.60714% with 15 lines in your changes missing coverage. Please review.

Project coverage is 75.63%. Comparing base (20087e2) to head (c314f61).
Report is 48 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7891      +/-   ##
==========================================
+ Coverage   75.61%   75.63%   +0.02%     
==========================================
  Files         460      461       +1     
  Lines       72135    72381     +246     
==========================================
+ Hits        54543    54745     +202     
- Misses      14104    14129      +25     
- Partials     3488     3507      +19     
Flag Coverage Δ
unittests 75.63% <86.60%> (+0.02%) ⬆️

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

func (gta *GlobalTSOAllocator) txnWithTTL(key, value string) (clientv3.LeaseID, error) {
ctx, cancel := context.WithTimeout(gta.ctx, etcdutil.DefaultRequestTimeout)
defer cancel()
grantResp, err := gta.am.etcdClient.Grant(ctx, 3)
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 setting a const for 3?


func (gta *GlobalTSOAllocator) register() (<-chan *clientv3.LeaseKeepAliveResponse, bool) {
ctx, cancel := context.WithTimeout(gta.ctx, time.Duration(3)*time.Second)
resp, err := gta.am.etcdClient.Get(ctx, gta.am.allocatorKeyPrefix, clientv3.WithPrefix())
Copy link
Member

Choose a reason for hiding this comment

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

The allocatorKeyPrefix varies in different modes, and it cannot retrieve keys from other allocators as expected.

Copy link
Member Author

Choose a reason for hiding this comment

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

nice catch!

@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 Apr 9, 2024
@rleungx rleungx force-pushed the register-allocator branch from 056d12a to 7f23d25 Compare April 15, 2024 06:59
@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 Apr 15, 2024
Copy link
Contributor

ti-chi-bot bot commented Aug 10, 2024

PR needs rebase.

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
@rleungx rleungx force-pushed the register-allocator branch from 7f23d25 to 9a75c5e Compare October 28, 2024 08:41
@ti-chi-bot ti-chi-bot bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Oct 28, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 28, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from rleungx, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@rleungx rleungx force-pushed the register-allocator branch from cddbb93 to c8a6dd3 Compare October 29, 2024 06:54
@rleungx rleungx removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 29, 2024
@rleungx rleungx force-pushed the register-allocator branch from c8a6dd3 to de79e49 Compare October 29, 2024 07:05
@rleungx rleungx requested a review from JmPotato October 29, 2024 08:48
@rleungx rleungx force-pushed the register-allocator branch from d2519ae to 40913a5 Compare October 30, 2024 06:33
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]>
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]>
@rleungx rleungx force-pushed the register-allocator branch from 40913a5 to c314f61 Compare October 31, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the dco. 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.

2 participants