Skip to content

Commit

Permalink
session, variable: cleanup TiDBEvolvePlanBaselines sysvar
Browse files Browse the repository at this point in the history
  • Loading branch information
morgo committed Aug 9, 2021
1 parent a7fdc2a commit 15c6541
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 0 additions & 3 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,9 +1158,6 @@ 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 == 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 {
return err
}
Expand Down
11 changes: 6 additions & 5 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ func (sv *SysVar) SetSessionFromHook(s *SessionVars, val string) error {
return err
}
}
// The 'baseline evolution' only work in the test environment before the feature is GA.
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

// Call the Set function on all the aliases for this sysVar
Expand Down Expand Up @@ -1488,7 +1484,12 @@ var defaultSysVars = []*SysVar{
s.UsePlanBaselines = TiDBOptOn(val)
return nil
}},
{Scope: ScopeGlobal | ScopeSession, Name: TiDBEvolvePlanBaselines, Value: BoolToOnOff(DefTiDBEvolvePlanBaselines), Type: TypeBool, SetSession: func(s *SessionVars, val string) error {
{Scope: ScopeGlobal | ScopeSession, Name: TiDBEvolvePlanBaselines, Value: BoolToOnOff(DefTiDBEvolvePlanBaselines), Type: TypeBool, Validation: func(vars *SessionVars, normalizedValue string, originalValue string, scope ScopeFlag) (string, error) {
if normalizedValue == "ON" && !config.CheckTableBeforeDrop {
return normalizedValue, errors.Errorf("Cannot enable baseline evolution feature, it is not generally available now")
}
return normalizedValue, nil
}, SetSession: func(s *SessionVars, val string) error {
s.EvolvePlanBaselines = TiDBOptOn(val)
return nil
}},
Expand Down

0 comments on commit 15c6541

Please sign in to comment.