Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

syncer/dbconn: add more retry error #1903

Merged
merged 3 commits into from
Jul 26, 2021
Merged

Conversation

glorv
Copy link
Collaborator

@glorv glorv commented Jul 22, 2021

What problem does this PR solve?

Auto retry for mysql.ErrInvalidConn and tidb's kv.RetryableErr (by pingcap/tidb-tools#452).

close #1825

What is changed and how it works?

  • When sql client interrupt (e.g. manually killed by kill tidb xxx), go-mysql will return mysql.ErrInvalidConn and this error is safe to auto-retry build the connection
  • tidb's kv.RetryableErr (currently only caused by TxnLockNotFound) is retryable too.

Check List

Tests

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

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

@glorv glorv added needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 labels Jul 22, 2021
@ti-chi-bot ti-chi-bot requested review from GMHDBJD and lichunzhu July 22, 2021 02:14
@ti-chi-bot
Copy link
Member

@Ehco1996: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

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.

@lance6716 lance6716 added this to the v2.0.5 milestone Jul 22, 2021
@lance6716 lance6716 changed the title add more retry error syncer/dbconn: add more retry error Jul 22, 2021
@@ -82,7 +83,7 @@ var (
func IsConnectionError(err error) bool {
err = errors.Cause(err)
switch err {
case driver.ErrBadConn, tmysql.ErrBadConn, gmysql.ErrBadConn:
case driver.ErrBadConn, tmysql.ErrBadConn, gmysql.ErrBadConn, mysql.ErrInvalidConn:
Copy link
Collaborator

Choose a reason for hiding this comment

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

we may not retry the ErrInvalidConn when it came from txn.Commit()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently, we will ignore invalid connection error for some DDL.

invalidConnF := func(tctx *tcontext.Context, err error, ddls []string, index int, conn *dbconn.DBConn) error {

Copy link
Collaborator

@GMHDBJD GMHDBJD 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 added the status/LGT1 One reviewer already commented LGTM label Jul 26, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • GMHDBJD
  • lance6716

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 added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Jul 26, 2021
@lance6716
Copy link
Collaborator

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: bf605b2

@ti-chi-bot ti-chi-bot merged commit 96bd744 into pingcap:master Jul 26, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #1916.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated size/S status/can-merge status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v2.0.4-Transaction-level retry for errors such as TxnLockNotFound
5 participants