Skip to content

Commit

Permalink
variable: Remove WARN for variable tidb_enable_noop_variable (#36890
Browse files Browse the repository at this point in the history
)

close #36647
  • Loading branch information
lcwangchao authored Aug 5, 2022
1 parent 2fbec00 commit 6be0810
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,15 @@ func TestGetSetNoopVars(t *testing.T) {
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 8144 setting query_cache_type has no effect in TiDB"))
// but the change is still effective.
tk.MustQuery("SELECT @@query_cache_type").Check(testkit.Rows("OFF"))

// Only ON and OFF supported
err := tk.ExecToErr("SET GLOBAL tidb_enable_noop_variables = 2")
require.Error(t, err)
require.Equal(t, "[variable:1231]Variable 'tidb_enable_noop_variables' can't be set to the value of '2'", err.Error())

err = tk.ExecToErr("SET GLOBAL tidb_enable_noop_variables = 'warn'")
require.Error(t, err)
require.Equal(t, "[variable:1231]Variable 'tidb_enable_noop_variables' can't be set to the value of 'warn'", err.Error())
}

func TestTruncateIncorrectIntSessionVar(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ var defaultSysVars = []*SysVar{
}, GetGlobal: func(s *SessionVars) (string, error) {
return BoolToOnOff(EnableConcurrentDDL.Load()), nil
}},
{Scope: ScopeGlobal, Name: TiDBEnableNoopVariables, Value: BoolToOnOff(DefTiDBEnableNoopVariables), Type: TypeEnum, PossibleValues: []string{Off, On, Warn}, SetGlobal: func(s *SessionVars, val string) error {
{Scope: ScopeGlobal, Name: TiDBEnableNoopVariables, Value: BoolToOnOff(DefTiDBEnableNoopVariables), Type: TypeEnum, PossibleValues: []string{Off, On}, SetGlobal: func(s *SessionVars, val string) error {
EnableNoopVariables.Store(TiDBOptOn(val))
return nil
}, GetGlobal: func(s *SessionVars) (string, error) {
Expand Down

0 comments on commit 6be0810

Please sign in to comment.