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 tso gRPC interfaces #5852

Closed
wants to merge 1 commit into from
Closed

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Jan 11, 2023

Signed-off-by: Ryan Leung rleungx@gmail.com

What problem does this PR solve?

Issue Number: Ref #5849.

What is changed and how does it work?

This PR implements Load/SaveTimestamp which will be used by the TSO service to persist the timestamp. Most of the change in this PR is go.sum, which is due to the upgrade of google.golang.org/grpc.

Check List

Tests

  • Unit test

Release note

None

@ti-chi-bot
Copy link
Member

[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.

@rleungx rleungx mentioned this pull request Jan 11, 2023
3 tasks
@rleungx rleungx requested review from JmPotato and removed request for HunDunDM January 11, 2023 09:37
@rleungx
Copy link
Member Author

rleungx commented Jan 11, 2023

@binshi-bing PTAL

@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Base: 75.42% // Head: 74.76% // Decreases project coverage by -0.66% ⚠️

Coverage data is based on head (e3fdecf) compared to base (be017f9).
Patch coverage: 61.45% of modified lines in pull request are covered.

❗ Current head e3fdecf differs from pull request most recent head 4103913. Consider uploading reports for the commit 4103913 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5852      +/-   ##
==========================================
- Coverage   75.42%   74.76%   -0.67%     
==========================================
  Files         337      339       +2     
  Lines       34123    34149      +26     
==========================================
- Hits        25736    25530     -206     
- Misses       6163     6421     +258     
+ Partials     2224     2198      -26     
Flag Coverage Δ
unittests 74.76% <61.45%> (-0.67%) ⬇️

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

Impacted Files Coverage Δ
client/client.go 67.49% <0.00%> (-0.92%) ⬇️
client/metrics.go 100.00% <ø> (ø)
server/grpc_service.go 47.39% <0.00%> (+0.33%) ⬆️
client/tso_client.go 61.70% <61.70%> (ø)
server/tso_service.go 63.04% <63.04%> (ø)
server/server.go 75.12% <100.00%> (+1.27%) ⬆️
pkg/storage/endpoint/resource_group.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/mcs/resource_manager/server/grpc_service.go 0.00% <0.00%> (-73.92%) ⬇️
pkg/mcs/resource_manager/server/manager.go 0.00% <0.00%> (-71.19%) ⬇️
pkg/mcs/resource_manager/server/resource_group.go 25.23% <0.00%> (-43.00%) ⬇️
... and 69 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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -139,6 +139,8 @@ type Client interface {
KeyspaceClient
// ResourceManagerClient manages resource group metadata and token assignment.
ResourceManagerClient
// TsoClient manages TSO data.
TsoClient
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's arguable to say whether we should use TSO rather than Tso 👀.

data := typeutil.Uint64ToBytes(request.GetTimestamp())
txn := kv.NewSlowLogTxn(client)
resp, err := txn.
Then(clientv3.OpPut(key, string(data))).
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 to compare the old one before putting in a new TSO to prevent it from fallback?

Copy link
Member Author

Choose a reason for hiding this comment

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

IMO, this part of logic will be done by the TSO service itself. The API service only needs to provide the storage interface.

Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering whether there will be a case in that different TSO services update the same key at the same time without knowing each other, maybe we should provide an option in the request to determine whether the check should be done. Otherwise, the services need to maintain some kind of mechanism to make sure consistency, which has a higher cost. On this hand, providing a simple check could save a lot of work. Since it's used to provide the TSO service, it makes sense to have such a customized change.

Copy link
Member Author

Choose a reason for hiding this comment

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

make sense

@lhy1024
Copy link
Contributor

lhy1024 commented Jan 11, 2023

Do we need to move externalTS?

@rleungx
Copy link
Member Author

rleungx commented Jan 12, 2023

Do we need to move externalTS?

Maybe. But this PR won't do it.

@rleungx rleungx force-pushed the tso-rpc branch 2 times, most recently from e3fdecf to 8c63b02 Compare January 12, 2023 06:45
@rleungx rleungx requested a review from JmPotato January 12, 2023 07:55
Signed-off-by: Ryan Leung <rleungx@gmail.com>
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 19, 2023
@ti-chi-bot
Copy link
Member

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

@rleungx
Copy link
Member Author

rleungx commented Jan 19, 2023

Closed since we are not going to wrap etcd API on the API service side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants