Skip to content

Commit

Permalink
executor: add rollback in releaseSysSession
Browse files Browse the repository at this point in the history
  • Loading branch information
lysu committed Dec 27, 2019
1 parent 510c36d commit 04617c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions executor/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ func (e *SimpleExec) getSysSession() (sessionctx.Context, error) {
}

func (e *SimpleExec) releaseSysSession(ctx sessionctx.Context) {
if ctx == nil {
return
}
dom := domain.GetDomain(e.ctx)
sysSessionPool := dom.SysSessionPool()
if _, err := ctx.(sqlexec.SQLExecutor).Execute(context.Background(), "rollback"); err != nil {
ctx.(pools.Resource).Close()
return
}
sysSessionPool.Put(ctx.(pools.Resource))
}

Expand Down

0 comments on commit 04617c1

Please sign in to comment.