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
executor: error processing refactor for load data #12465
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12465 +/- ##
===============================================
+ Coverage 79.9213% 79.936% +0.0146%
===============================================
Files 460 460
Lines 103732 103803 +71
===============================================
+ Hits 82904 82976 +72
- Misses 14760 14761 +1
+ Partials 6068 6066 -2 |
} | ||
return cc.ctx.CommitTxn(sessionctx.SetCommitCtx(ctx, loadDataInfo.Ctx)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this snippet will remove function added by #9444?
maybe some reason we need txn.Rollback
here if txn.Valid
and have err
, PTAL @crazycs520
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
former implementation will leave one batch/txn undecided out for loop, so the main logic need to process the last txn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @crazycs520
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackysp PTAL
@@ -461,7 +461,9 @@ func (s *session) StmtCommit() error { | |||
// StmtRollback implements the sessionctx.Context interface. | |||
func (s *session) StmtRollback() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tiancaiamao PTAL if we can change StmtRollback
like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's ok.
B.T.W, I'm thinking of removing the assertion proto which is introduced to add an additional check for write consistency, but I find it's hard to achieve that goal.
LGTM @crazycs520 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-all-tests |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
@cfzjywxk merge failed. |
/merge |
/run-all-tests |
@cfzjywxk merge failed. |
/merge |
Your auto merge job has been accepted, waiting for 12458 |
/merge |
/run-all-tests |
What problem does this PR solve?
there are two different modifications(maybe they should not be considered together?)
remove old logic in load data error processing,
commitWork
function will commit or rollback txn. Former implementation will make query processing panic since commit fail andtxn
is invalid.Ealier tidb version still has this problem(2.1 3.0), you will get
lost connection
error if doing sth like ddl betweenload data
doCommit
function defer will make txnchangeToInvalid
, so ifcommit
failed andstmtRollBack
is called,txnState
has niltransaction
field, which will causeConfirmAssertions
operation report panic error "invalid memory nil"some unit-test or tidb-test will be added for this situation
What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release note