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

client-go/safeTS: reduce GetStoreMinResolvedTS call #46664

Closed
HuSharp opened this issue Sep 5, 2023 · 2 comments · Fixed by #46661
Closed

client-go/safeTS: reduce GetStoreMinResolvedTS call #46664

HuSharp opened this issue Sep 5, 2023 · 2 comments · Fixed by #46661

Comments

@HuSharp
Copy link
Contributor

HuSharp commented Sep 5, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

img_v2_0c514c8b-243c-411a-bcdf-a46bbfa2f4ag
related to tikv/client-go#922

currently, we try to GetStoreMinResolvedTS for all stores from PD every 2 seconds

Background

For txn_scope

txn_scope will be global in major situation, So we can judge @@txn_scope value which from the config:
when find is global, we can get cluster-level resolved ts to avoid using kv grpc.

If not, we need to enhance min resolved ts usage:

For min resolved ts

Nowadays we have 2 api interface for obtaining min resolved ts

  • /pd/api/v1/min-resolved-ts: obtain cluster's min resolved ts
  • /pd/api/v1/min-resolved-ts/{store_id}: obtain each store's min resolved ts

We can use the approach I to get cluster's min resolved ts when @@txn_scope is global.
For client-go's updateSafeTS, we call approach II for each store, which is not necessary.
We can extend the approach I params to obtain specified store via a list to reduce the cost per call after api: Extend the min-resolved-ts api to support getting the specified store pd#6880 merged

1. Minimal reproduce step (Required)

For example when we have 100 tikvs and 100 tidbs, then the connections for pd/api/v1/min-resolved-ts to PD would be 100*100/2=5000 in 1 seconds.

2. What did you expect to see? (Required)

reduce pd/api/v1/min-resolved-ts call

3. What did you see instead (Required)

For example when we have 100 tikvs and 100 tidbs, then the connections for pd/api/v1/min-resolved-ts to PD would be 100*100/2=5000 in 1 seconds.

4. What is your TiDB version? (Required)

master

@HuSharp HuSharp added the type/bug The issue is confirmed as a bug. label Sep 5, 2023
@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 5, 2023

/affect-7.1

@HuSharp
Copy link
Contributor Author

HuSharp commented Sep 28, 2023

release-6.5 has been fixed in #46143 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants