Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session, variable: cleanup TiDBEvolvePlanBaselines sysvar validation #27004

Merged
merged 1 commit into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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