sessionctx: fix a deadlock when set tidb_restricted_read_only = true (#55407)
close pingcap/tidb#53822, close pingcap/tidb#55373
This commit is contained in:
@ -823,7 +823,11 @@ var defaultSysVars = []*SysVar{
|
||||
on := TiDBOptOn(val)
|
||||
// For user initiated SET GLOBAL, also change the value of TiDBSuperReadOnly
|
||||
if on && s.StmtCtx.StmtType == "Set" {
|
||||
err := s.GlobalVarsAccessor.SetGlobalSysVar(context.Background(), TiDBSuperReadOnly, "ON")
|
||||
err := s.GlobalVarsAccessor.SetGlobalSysVarOnly(context.Background(), TiDBSuperReadOnly, "ON", false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = GetSysVar(TiDBSuperReadOnly).SetGlobal(context.Background(), s, "ON")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user