From 6c938a72e0f9add34e5b85961ad71868bf6ff30e Mon Sep 17 00:00:00 2001 From: yisaer Date: Tue, 25 May 2021 15:55:22 +0800 Subject: [PATCH] address the comment Signed-off-by: yisaer address the comment Signed-off-by: yisaer --- executor/simple.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/executor/simple.go b/executor/simple.go index 82ad321d833fb..0eadfd5f85dd2 100644 --- a/executor/simple.go +++ b/executor/simple.go @@ -603,14 +603,14 @@ func (e *SimpleExec) executeBegin(ctx context.Context, s *ast.BeginStmt) error { // If BEGIN is the first statement in TxnCtx, we can reuse the existing transaction, without the // need to call NewTxn, which commits the existing transaction and begins a new one. // If the last un-committed/un-rollback transaction is a time-bounded read-only transaction, we should + // always create a new transaction. txnCtx := e.ctx.GetSessionVars().TxnCtx if txnCtx.History != nil || txnCtx.IsStaleness { err := e.ctx.NewTxn(ctx) if err != nil { return err } - } // always create a new transaction. - + } // With START TRANSACTION, autocommit remains disabled until you end // the transaction with COMMIT or ROLLBACK. The autocommit mode then // reverts to its previous state.