session: call "begin" in a transaction will auto commit, log this operation (#6122)
This commit is contained in:
@ -956,11 +956,13 @@ func (s *session) Txn() kv.Transaction {
|
||||
|
||||
func (s *session) NewTxn() error {
|
||||
if s.txn.Valid() {
|
||||
txnID := s.txn.StartTS()
|
||||
ctx := context.TODO()
|
||||
err := s.CommitTxn(ctx)
|
||||
if err != nil {
|
||||
return errors.Trace(err)
|
||||
}
|
||||
log.Infof("[con:%d] NewTxn() inside a transaction auto commit: %d", s.GetSessionVars().ConnectionID, txnID)
|
||||
}
|
||||
|
||||
txn, err := s.store.Begin()
|
||||
|
||||
Reference in New Issue
Block a user