domain: 'load privilege failed' when autocommit is off (#26691)

This commit is contained in:
jiyfhust
2021-08-02 16:05:06 +08:00
committed by GitHub
parent fdd6663d30
commit 6eaac8cc5b

View File

@ -853,8 +853,12 @@ func (do *Domain) GetEtcdClient() *clientv3.Client {
// should be called only once in BootstrapSession.
func (do *Domain) LoadPrivilegeLoop(ctx sessionctx.Context) error {
ctx.GetSessionVars().InRestrictedSQL = true
_, err := ctx.(sqlexec.SQLExecutor).ExecuteInternal(context.Background(), "set @@autocommit = 1")
if err != nil {
return err
}
do.privHandle = privileges.NewHandle()
err := do.privHandle.Update(ctx)
err = do.privHandle.Update(ctx)
if err != nil {
return err
}