Skip to content

Commit

Permalink
sessionctx: fix a deadlock when set tidb_restricted_read_only = true (
Browse files Browse the repository at this point in the history
#55407)

close #53822, close #55373
  • Loading branch information
Defined2014 authored Aug 14, 2024
1 parent 6499137 commit 1b172b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 1b172b6

Please sign in to comment.