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

backoff: deep copy the needed fields for backoffer type #453

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

cfzjywxk
Copy link
Contributor

@cfzjywxk cfzjywxk commented Mar 21, 2022

Close: pingcap/tidb#33265

Related changes:

  • Avoid possible race changing the global backoff type config.
  • Check nil before using the longestSleepCfg result.
  • Copy the configs, backoffSleepMS and backoffTimes fields more deeply but not complete deeply.

The Backoffer is not very robust by now and it's easy to make mistakes, maybe we need to open a enhancement task for it in the future to avoid data races and related risks.

Signed-off-by: cfzjywxk [email protected]

internal/retry/backoff.go Show resolved Hide resolved
internal/retry/backoff.go Show resolved Hide resolved
Copy link
Collaborator

@sticnarf sticnarf left a comment

Choose a reason for hiding this comment

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

LGTM

@youjiali1995 youjiali1995 merged commit f4eae62 into tikv:master Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tidb panic after inject network loss chaos repeatly
3 participants