Skip to content
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

*: support pessimistic transaction (experimental feature) #10297

merged 13 commits into from May 11, 2019

use session variable

  • Loading branch information...
coocood committed Apr 30, 2019
commit 48f7d90af052a2aff82bc7cc6a1c5679da51866b
@@ -304,7 +304,7 @@ func (e *SimpleExec) executeBegin(ctx context.Context, s *ast.BeginStmt) error {
e.ctx.GetSessionVars().SetStatusFlag(mysql.ServerStatusInTrans, true)
// Call ctx.Txn(true) to active pending txn.
pTxnConf := config.GetGlobalConfig().PessimisticTxn
if pTxnConf.Enable && (s.Pessimistic || pTxnConf.Default) {
if pTxnConf.Enable && (s.Pessimistic || pTxnConf.Default || e.ctx.GetSessionVars().PessimisticLock) {
e.ctx.GetSessionVars().TxnCtx.IsPessimistic = true
txn, err := e.ctx.Txn(true)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.