tidb: Refactor GetTxn
This commit is contained in:
11
session.go
11
session.go
@ -506,17 +506,10 @@ func (s *session) GetTxn(forceNew bool) (kv.Transaction, error) {
|
||||
return s.txn, nil
|
||||
}
|
||||
if forceNew {
|
||||
err = s.txn.Commit()
|
||||
variable.GetSessionVars(s).SetStatusFlag(mysql.ServerStatusInTrans, false)
|
||||
err = s.FinishTxn(false)
|
||||
if err != nil {
|
||||
if !s.retrying && kv.IsRetryableError(err) {
|
||||
err = s.Retry()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Trace(err)
|
||||
}
|
||||
return nil, errors.Trace(err)
|
||||
}
|
||||
s.resetHistory()
|
||||
s.txn, err = s.store.Begin()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user