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

retry, client: support to log after execing some times #7895

Merged
merged 8 commits into from
Apr 9, 2024

Conversation

CabinfeverB
Copy link
Member

What problem does this PR solve?

Issue Number: ref #7894

What is changed and how does it work?

Check List

Tests

  • Unit test

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

None.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Copy link
Contributor

ti-chi-bot bot commented Mar 7, 2024

[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 Mar 7, 2024
@ti-chi-bot ti-chi-bot bot requested review from lhy1024 and Yisaer March 7, 2024 10:26
@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
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Merging #7895 (a197f58) into master (a1e957d) will decrease coverage by 0.39%.
The diff coverage is 58.33%.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7895      +/-   ##
==========================================
- Coverage   73.81%   73.43%   -0.39%     
==========================================
  Files         436      434       -2     
  Lines       48554    48078     -476     
==========================================
- Hits        35840    35305     -535     
- Misses       9675     9722      +47     
- Partials     3039     3051      +12     
Flag Coverage Δ
unittests 73.43% <58.33%> (-0.39%) ⬇️

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

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
type Option func(*Backoffer)

// WithLogTimes sets the number of retries required to print a log.
func WithLogTimes(logTimes int) Option {
Copy link
Member

Choose a reason for hiding this comment

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

I think it should belong to the log component?

Copy link
Member Author

Choose a reason for hiding this comment

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

But the log component doesn't know how many times the backoffer has done?
How about providing a function param that the caller defines? like func WithActionAfterTimes(times int, fn func()) Option

Copy link
Member

Choose a reason for hiding this comment

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

For the caller, I think it's different to know how to set this value, it's affected by the backoff policy. If we must do it, I prefer something like withMinLogInterval.

Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@ti-chi-bot ti-chi-bot 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 29, 2024
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@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 7, 2024
// Option is used to customize the backoffer.
type Option func(*Backoffer)

// withMinLogInterval sets the mininum log interval for retrying.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// withMinLogInterval sets the mininum log interval for retrying.
// withMinLogInterval sets the minimum log interval for retrying.

Copy link
Member

Choose a reason for hiding this comment

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

maybe can add more comments/change this function name, It seems unrelated to the minimum?

client/retry/backoff_test.go Show resolved Hide resolved
client/retry/backoff_test.go Outdated Show resolved Hide resolved
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
@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 Apr 9, 2024
@HuSharp
Copy link
Member

HuSharp commented Apr 9, 2024

/merge

Copy link
Contributor

ti-chi-bot bot commented Apr 9, 2024

@HuSharp: 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 Apr 9, 2024

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

Commit hash: 54f79d8

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 9, 2024
@ti-chi-bot ti-chi-bot bot merged commit 80a2fd9 into tikv:master Apr 9, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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