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

Associate each region with an independent backoffer #17568

Merged
merged 4 commits into from
Jun 2, 2020

Conversation

hunterlxt
Copy link
Contributor

Signed-off-by: Xintao hunterlxt@live.com

What problem does this PR solve?

Issue Number: close tikv/tikv#7853

Problem Summary:
The backoffer of the boRegionMiss has a backoff mechanism with a starting time of 2ms and a maximum of 500ms. After log verification, a SQL command will share the same backoffer, that is, if multiple regions return epoch not match error, then the backoffer will quickly rise to 500ms. It is easy to exceed the preset time limit of 40s, causing SQL errors on the client.

What is changed and how it works?

What's Changed: Add a function to get Backoffer

How it Works: Use a Map to store backoffer with specific region id

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. split table x between (0) and (10000000) regions 400
  2. select count(*) from x

Before this PR, the SQL usually returns region is unavailable

Side effects

No

Release note

  • Assign different Backoffer for each region to avoid the SQL command timeout issue when multiple region requests fail at the same time

Signed-off-by: Xintao <hunterlxt@live.com>
@CLAassistant
Copy link

CLAassistant commented Jun 1, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jun 1, 2020

Codecov Report

Merging #17568 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #17568   +/-   ##
===========================================
  Coverage   79.6747%   79.6747%           
===========================================
  Files           520        520           
  Lines        141469     141469           
===========================================
  Hits         112715     112715           
  Misses        19763      19763           
  Partials       8991       8991           

@hunterlxt
Copy link
Contributor Author

hunterlxt commented Jun 2, 2020

@lzmhhh123 @lysu
image

@hunterlxt
Copy link
Contributor Author

cc @hicqu

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

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

LGTM

@lzmhhh123 lzmhhh123 added component/tikv needs-cherry-pick-3.0 status/LGT1 Indicates that a PR has LGTM 1. type/enhancement The issue or PR belongs to an enhancement. labels Jun 2, 2020
Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu lysu added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 2, 2020
@lysu
Copy link
Contributor

lysu commented Jun 2, 2020

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 2, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2020

/run-all-tests

@sre-bot sre-bot merged commit 219f99a into pingcap:master Jun 2, 2020
@hunterlxt hunterlxt deleted the XT/backoff-fix branch June 2, 2020 07:57
sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Jun 2, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2020

cherry pick to release-3.0 in PR #17583

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Jun 2, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2020

cherry pick to release-3.1 in PR #17584

sre-bot pushed a commit to sre-bot/tidb that referenced this pull request Jun 2, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>
@sre-bot
Copy link
Contributor

sre-bot commented Jun 2, 2020

cherry pick to release-4.0 in PR #17585

sre-bot added a commit that referenced this pull request Jun 6, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>

Co-authored-by: Xintao <hunterlxt@live.com>
ti-srebot added a commit that referenced this pull request Jun 28, 2020
Signed-off-by: sre-bot <sre-bot@pingcap.com>

Co-authored-by: Xintao <hunterlxt@live.com>
Co-authored-by: ti-srebot <66930949+ti-srebot@users.noreply.github.com>
ti-srebot pushed a commit that referenced this pull request Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tikv status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encounter region unavailable when selecting data
5 participants