server: retry executing sql without tiflash after tiflash is down#22459
Merged
ti-srebot merged 17 commits intopingcap:masterfrom Feb 5, 2021
Merged
server: retry executing sql without tiflash after tiflash is down#22459ti-srebot merged 17 commits intopingcap:masterfrom
ti-srebot merged 17 commits intopingcap:masterfrom
Conversation
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
/cc @winoros |
qw4990
reviewed
Jan 27, 2021
Contributor
Author
|
/run-all-tests |
qw4990
reviewed
Jan 27, 2021
server/conn.go
Outdated
| retryable, err = cc.handleStmt(ctx, stmt, parserWarns, i == len(stmts)-1) | ||
| if err != nil { | ||
| break | ||
| if terror.ErrorEqual(err, tikv.ErrTiFlashServerTimeout) && retryable { |
Contributor
There was a problem hiding this comment.
It's better to introduce a switch(generally it is implemented as a SQL variable) to control if we retry here.
qw4990
reviewed
Jan 27, 2021
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
/run-mybatis-test |
Contributor
|
PTAL @winoros |
qw4990
reviewed
Jan 28, 2021
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
/run-all-tests |
Contributor
Author
Contributor
Author
|
/run-all-tests |
qw4990
reviewed
Feb 4, 2021
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
/run-all-tests |
ti-srebot
approved these changes
Feb 5, 2021
Contributor
|
/merge |
Contributor
|
Your auto merge job has been accepted, waiting for:
|
Contributor
|
/run-all-tests |
This was referenced Mar 23, 2021
12 tasks
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Problem Summary:
When we get a backoff error of TiFlash, the SQL will always fail while the TiKV nodes are actually alive. We hope to fallback to TiKV after TiFlash is down.
What is changed and how it works?
Proposal: https://docs.google.com/document/d/1dgq1MZQigTcZeck0iRLSCAu_ly3iGDr19Et6IHfQhCs/edit?usp=sharing (This PR implements simple solution section)
What's Changed & How it Works:
When running
clientConn.handleQuery/clientConn.handleStmtExecute, if we getErrTiFlashServerTimeouterror and the execution of SQL does't have side effect (If TiDB server already sends data to client or the execution is in cursor mode, the execution has side effect), we delete TiFlash fromIsolationReadEngines, retry executing the SQL and add TiFlash back toIsolationReadEngines. Besides, we use a switchtidb_enable_tiflash_fallback_tikvto control whether to retry and the switch is off by default.Related changes
pingcap/docs/pingcap/docs-cn: system variable: add tidb_allow_fallback_to_tikv docs#4781 / system variable: add tidb_allow_fallback_to_tikv docs-cn#5484Check List
Tests
Release note