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

Support service mode switching for tso and change the value type of tso primary to tsopb.Participant #6160

Merged
merged 14 commits into from
Mar 20, 2023

Conversation

binshi-bing
Copy link
Contributor

@binshi-bing binshi-bing commented Mar 14, 2023

Support service mode switching for and change the value type of tso primary

What problem does this PR solve?

Issue Number: Ref #5836

What is changed and how does it work?

Support tso service switched between PD mode and API mode;
Add server/client implemenation for the GetClusterInfo rpc
Add tsopb.Participant as the value type of tso primary

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • Performance test

Conclusion: no performance regression.

w/ change
Total:
count: 28949005, max: 6.1310ms, min: 0.0410ms, avg: 2.0541ms
<1ms: 479588, >1ms: 11500091, >2ms: 16969184, >5ms: 142, >10ms: 0, >30ms: 0, >50ms: 0, >100ms: 0, >200ms: 0, >400ms: 0, >800ms: 0, >1s: 0
count: 28949005, <1ms: 1.66%, >1ms: 39.73%, >2ms: 58.62%, >5ms: 0.00%, >10ms: 0.00%, >30ms: 0.00%, >50ms: 0.00%, >100ms: 0.00%, >200ms: 0.00%, >400ms: 0.00%, >800ms: 0.00%, >1s: 0.00%
P0.5: 2.0470ms, P0.8: 2.2553ms, P0.9: 2.4288ms, P0.99: 3.1310ms

w/o change
Total:
count: 28181983, max: 9.9771ms, min: 0.0616ms, avg: 2.0791ms
<1ms: 367685, >1ms: 10210926, >2ms: 17602085, >5ms: 1287, >10ms: 0, >30ms: 0, >50ms: 0, >100ms: 0, >200ms: 0, >400ms: 0, >800ms: 0, >1s: 0
count: 28181983, <1ms: 1.30%, >1ms: 36.23%, >2ms: 62.46%, >5ms: 0.00%, >10ms: 0.00%, >30ms: 0.00%, >50ms: 0.00%, >100ms: 0.00%, >200ms: 0.00%, >400ms: 0.00%, >800ms: 0.00%, >1s: 0.00%
P0.5: 2.0682ms, P0.8: 2.2742ms, P0.9: 2.4449ms, P0.99: 3.1436ms

Release note

None.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 14, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lhy1024
  • rleungx

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
Copy link
Member

Hi @binshi-bing. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@binshi-bing binshi-bing changed the title Support service mode switching for and change the value type of tso primary Support service mode switching for tso and change the value type of tso primary Mar 14, 2023
@binshi-bing binshi-bing changed the title Support service mode switching for tso and change the value type of tso primary Support service mode switching for tso and change the value type of tso primary to tsopb.Participant Mar 14, 2023
@binshi-bing binshi-bing force-pushed the service-mode-switching branch 2 times, most recently from 3c35e9e to 1d4759b Compare March 14, 2023 05:02
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 14, 2023
client/pd_service_discovery.go Outdated Show resolved Hide resolved
client/pd_service_discovery.go Outdated Show resolved Hide resolved
pkg/mcs/meta_storage/server/grpc_service.go Outdated Show resolved Hide resolved
pkg/mcs/tso/server/server.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 14, 2023
@lhy1024
Copy link
Contributor

lhy1024 commented Mar 15, 2023

/ok-to-test

client/client.go Outdated Show resolved Hide resolved
client/client.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Patch coverage: 76.21% and project coverage change: -0.06 ⚠️

Comparison is base (6eb4410) 74.54% compared to head (2f5422f) 74.48%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6160      +/-   ##
==========================================
- Coverage   74.54%   74.48%   -0.06%     
==========================================
  Files         393      393              
  Lines       38527    38627     +100     
==========================================
+ Hits        28719    28772      +53     
- Misses       7268     7300      +32     
- Partials     2540     2555      +15     
Flag Coverage Δ
unittests 74.48% <76.21%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
client/errs/errno.go 100.00% <ø> (ø)
pkg/mcs/meta_storage/server/grpc_service.go 59.61% <0.00%> (ø)
pkg/mcs/resource_manager/server/grpc_service.go 67.77% <0.00%> (ø)
pkg/storage/endpoint/key_path.go 93.33% <ø> (ø)
server/api/server.go 100.00% <ø> (ø)
client/tso_stream.go 73.49% <31.25%> (-5.38%) ⬇️
client/keyspace_client.go 63.63% <33.33%> (ø)
client/meta_storage_client.go 68.47% <50.00%> (ø)
client/resource_manager_client.go 70.29% <50.00%> (ø)
server/server.go 74.33% <62.50%> (-0.58%) ⬇️
... and 14 more

... and 17 files with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ti-chi-bot ti-chi-bot added status/LGT1 Indicates that a PR has LGTM 1. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 16, 2023
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2023
@rleungx
Copy link
Member

rleungx commented Mar 17, 2023

CI failed.

client/go.mod Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 20, 2023
… as the value type of tso primary

Support tso service switched between PD mode and API mode
Add server/client implemenation for the GetClusterInfo rpc and support service mode in the client

Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
… keep the current mode instead of swtiching to unknown mode.

Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Fixed the following cases:
1. Timeout issue. Previously, after starting the API service, the test suite tried to create the PD client before starting TSO servers. PD client will try to connect to TSO service with 30 retries and 30s in total. The fix is to change the retry time, overriden by the option passed to NewClientWithContext, to 1.
2. GetTS Failure. Previously, after staring TSO server, the test immediate sent GetTS() requests, but it won't succeed until the TSO servers complete the primary election and the client refresh the primary address. The fix is to add WaitForPrimaryServing() and WaitForTSOServiceAvailable() and to catch the io.EOF for stream.send()/recv() and refresh primary address immediately.
3. The test suite is too heavy. Turn SetupTest/TeardownTest to SetupSuite/TearDownSuite to avoid duplicate setups of the cluster.

After the above fixes, the test suite needs more than 50s and will timeout in vscode but ok when running from commandline.

Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 20, 2023
Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

The rest lgtm

pkg/mcs/resource_manager/server/server.go Outdated Show resolved Hide resolved
pkg/mcs/tso/server/server.go Show resolved Hide resolved
server/server.go Show resolved Hide resolved
client/client.go Show resolved Hide resolved
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 20, 2023
@JmPotato
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@JmPotato: 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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 2f5422f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 20, 2023
@ti-chi-bot ti-chi-bot merged commit 8d1d091 into tikv:master Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test release-note-none status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants