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/http: implement more HTTP APIs #7371

Merged
merged 4 commits into from
Nov 17, 2023

Conversation

JmPotato
Copy link
Member

@JmPotato JmPotato commented Nov 15, 2023

What problem does this PR solve?

Issue Number: ref #7300.

What is changed and how does it work?

- Implement more HTTP APIs.
- Use consts more in `Rule` structure.

Check List

Tests

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

Release note

None.

@JmPotato JmPotato added component/api HTTP API. component/client Client logic. labels Nov 15, 2023
Copy link
Contributor

ti-chi-bot bot commented Nov 15, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • HuSharp
  • 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 ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Nov 15, 2023
@ti-chi-bot ti-chi-bot bot requested a review from rleungx November 15, 2023 07:11
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #7371 (6cef656) into master (f2eaf23) will increase coverage by 0.00%.
The diff coverage is 41.48%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7371   +/-   ##
=======================================
  Coverage   74.28%   74.29%           
=======================================
  Files         451      451           
  Lines       48899    48967   +68     
=======================================
+ Hits        36327    36380   +53     
- Misses       9348     9369   +21     
+ Partials     3224     3218    -6     
Flag Coverage Δ
unittests 74.29% <41.48%> (+<0.01%) ⬆️

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

@JmPotato
Copy link
Member Author

/cc @HuSharp @nolouch @CabinfeverB

client/http/client.go Outdated Show resolved Hide resolved
client/http/client.go Outdated Show resolved Hide resolved
@@ -154,7 +159,7 @@ func (c *client) execDuration(name string, duration time.Duration) {
// it consistent with the current implementation of some clients (e.g. TiDB).
func (c *client) requestWithRetry(
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to customize the retry?

Copy link
Member Author

Choose a reason for hiding this comment

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

We will provide the function of custom backoffer in the future, but at present, the interface we are about to replace in TiDB uses this simple retry method.

Copy link
Member

Choose a reason for hiding this comment

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

I still prefer to leave it to the caller even if the retry method is simple.

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 to me though I'd like to implement it in an independent PR later.

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 16, 2023
func (c *client) SetPlacementRule(ctx context.Context, rule *Rule) error {
ruleJSON, err := json.Marshal(rule)
if err != nil {
return errors.Trace(err)
Copy link
Member

Choose a reason for hiding this comment

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

not sure why needs errors.Trace?

Copy link
Member Author

Choose a reason for hiding this comment

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

One is to be consistent with the original HTTP call code of TiDB, and the other is that because it is a general library, adding trace information can help us better locate where the call is wrong I think.

@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 17, 2023
Copy link
Member

@HuSharp HuSharp left a comment

Choose a reason for hiding this comment

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

LGTM!

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 17, 2023
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
@JmPotato
Copy link
Member Author

/merge

Copy link
Contributor

ti-chi-bot bot commented Nov 17, 2023

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Nov 17, 2023

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

Commit hash: 6cef656

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 17, 2023
@ti-chi-bot ti-chi-bot bot merged commit dda748a into tikv:master Nov 17, 2023
24 of 26 checks passed
@JmPotato JmPotato deleted the more_http_interfaces branch November 17, 2023 04:18
@JmPotato JmPotato mentioned this pull request Nov 21, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/api HTTP API. component/client Client logic. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. 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.

3 participants