session: call "begin" in a transaction will auto commit, log this operation (#6122)

This commit is contained in:
tiancaiamao
2018-03-22 22:37:24 -05:00
committed by winkyao
parent 688690a07f
commit 03a445a5ce

View File

@ -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()