-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
kv, store: remove Rollback
in RunInNewTxn
#8250
Conversation
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-common-test |
@@ -33,6 +34,10 @@ func (s *testCommitterSuite) TestFailCommitPrimaryRpcErrors(c *C) { | |||
err = t1.Commit(context.Background()) | |||
c.Assert(err, NotNil) | |||
c.Assert(terror.ErrorEqual(err, terror.ErrResultUndetermined), IsTrue, Commentf("%s", errors.ErrorStack(err))) | |||
|
|||
// We don't need to call "Rollback" after "Commit" fails. |
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.
The comment confuses me. Why do you call the Rollback()
in line 39?
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.
This test is used to prove why the rollback was removed in "RunInNewTxn".
@@ -63,8 +60,6 @@ func RunInNewTxn(store Storage, retryable bool, f func(txn Transaction) error) e | |||
} | |||
if retryable && IsRetryableError(err) { | |||
log.Warnf("[kv] Retry txn %v original txn %v err %v", txn, originalTxnTS, err) | |||
err1 := txn.Rollback() |
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.
ditto
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.
I said
If "Commit" is completed, it will call txn's
close
. So we can remove Rollback and the print log in RunInNewTxn.
PTAL @jackysp @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
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-integration-ddl-test |
What problem does this PR solve?
In the RunInNewTxn function, the error of
invalid transaction
will be reported when the commit fails.What is changed and how it works?
If "Commit" is completed, it will call txn's
close
. So we can removeRollback
and the print log inRunInNewTxn
.Check List
Tests
Related changes