Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Reminiscent committed Aug 4, 2021
1 parent 0ee830b commit 5756178
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion bindinfo/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,9 @@ func (s *testSuite) TestForbidEvolvePlanBaseLinesBeforeGA(c *C) {
s.cleanBindingEnv(tk)
err := tk.ExecToErr("set @@tidb_evolve_plan_baselines=0")
c.Assert(err, Equals, nil)
err = tk.ExecToErr("set @@tidb_evolve_plan_baselines=1")
err = tk.ExecToErr("set @@TiDB_Evolve_pLan_baselines=1")
c.Assert(err, ErrorMatches, "Cannot enable baseline evolution feature, it is not generally available now")
err = tk.ExecToErr("set @@TiDB_Evolve_pLan_baselines=oN")
c.Assert(err, ErrorMatches, "Cannot enable baseline evolution feature, it is not generally available now")
err = tk.ExecToErr("admin evolve bindings")
c.Assert(err, ErrorMatches, "Cannot enable baseline evolution feature, it is not generally available now")
Expand Down
2 changes: 1 addition & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ func (s *session) SetGlobalSysVar(name, value string) (err error) {
if value, err = sv.Validate(s.sessionVars, value, variable.ScopeGlobal); err != nil {
return err
}
if sv.Name == "tidb_evolve_plan_baselines" && strings.EqualFold("ON", value) && !config.CheckTableBeforeDrop {
if sv.Name == variable.TiDBEvolvePlanBaselines && value == "ON" && !config.CheckTableBeforeDrop {
return errors.Errorf("Cannot enable baseline evolution feature, it is not generally available now")
}
if err = sv.SetGlobalFromHook(s.sessionVars, value, false); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (sv *SysVar) SetSessionFromHook(s *SessionVars, val string) error {
}
}
// The 'baseline evolution' only work in the test environment before the feature is GA.
if sv.Name == "tidb_evolve_plan_baselines" && strings.EqualFold("ON", val) && !config.CheckTableBeforeDrop {
if sv.Name == TiDBEvolvePlanBaselines && val == "ON" && !config.CheckTableBeforeDrop {
return errors.Errorf("Cannot enable baseline evolution feature, it is not generally available now")
}
s.systems[sv.Name] = val
Expand Down

0 comments on commit 5756178

Please sign in to comment.