Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <[email protected]>
  • Loading branch information
hawkingrei committed Aug 23, 2024
1 parent 7edad5e commit 112c74c
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 440 deletions.
3 changes: 0 additions & 3 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,8 +870,6 @@ func TestSetVar(t *testing.T) {
require.Equal(t, uint64(2), tk.Session().GetSessionVars().CDCWriteSource)
tk.MustExec("set @@session.tidb_cdc_write_source = 0")
require.Equal(t, uint64(0), tk.Session().GetSessionVars().CDCWriteSource)
<<<<<<< HEAD
=======

tk.MustQuery("select @@session.tidb_analyze_skip_column_types").Check(testkit.Rows("json,blob,mediumblob,longblob"))
tk.MustExec("set @@session.tidb_analyze_skip_column_types = 'json, text, blob'")
Expand Down Expand Up @@ -900,7 +898,6 @@ func TestSetVar(t *testing.T) {
tk.MustQuery("select @@session.tidb_skip_missing_partition_stats").Check(testkit.Rows("0"))
tk.MustExec("set session tidb_skip_missing_partition_stats = 1")
tk.MustQuery("select @@session.tidb_skip_missing_partition_stats").Check(testkit.Rows("1"))
>>>>>>> a492a371a74 (statistics: merge global stats even if some partition stats are missing (#41176))
}

func TestGetSetNoopVars(t *testing.T) {
Expand Down
29 changes: 0 additions & 29 deletions sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1334,40 +1334,11 @@ type SessionVars struct {

// OptimizerFixControl control some details of the optimizer behavior through the tidb_opt_fix_control variable.
OptimizerFixControl map[uint64]string
<<<<<<< HEAD
=======

// FastCheckTable is used to control whether fast check table is enabled.
FastCheckTable bool

// HypoIndexes are for the Index Advisor.
HypoIndexes map[string]map[string]map[string]*model.IndexInfo // dbName -> tblName -> idxName -> idxInfo

// TiFlashReplicaRead indicates the policy of TiFlash node selection when the query needs the TiFlash engine.
TiFlashReplicaRead tiflash.ReplicaRead

// HypoTiFlashReplicas are for the Index Advisor.
HypoTiFlashReplicas map[string]map[string]struct{} // dbName -> tblName -> whether to have replicas

// Runtime Filter Group
// Runtime filter type: only support IN or MIN_MAX now.
// Runtime filter type can take multiple values at the same time.
runtimeFilterTypes []RuntimeFilterType
// Runtime filter mode: only support OFF, LOCAL now
runtimeFilterMode RuntimeFilterMode

// Whether to lock duplicate keys in INSERT IGNORE and REPLACE statements,
// or unchanged unique keys in UPDATE statements, see PR #42210 and #42713
LockUnchangedKeys bool

// AnalyzeSkipColumnTypes indicates the column types whose statistics would not be collected when executing the ANALYZE command.
AnalyzeSkipColumnTypes map[string]struct{}

// SkipMissingPartitionStats controls how to handle missing partition stats when merging partition stats to global stats.
// When set to true, skip missing partition stats and continue to merge other partition stats to global stats.
// When set to false, give up merging partition stats to global stats.
SkipMissingPartitionStats bool
>>>>>>> a492a371a74 (statistics: merge global stats even if some partition stats are missing (#41176))
}

var (
Expand Down
225 changes: 0 additions & 225 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -2304,235 +2304,10 @@ var defaultSysVars = []*SysVar{
return nil
},
},
<<<<<<< HEAD
=======
{Scope: ScopeGlobal | ScopeSession, Name: TiDBFastCheckTable, Value: BoolToOnOff(DefTiDBEnableFastCheckTable), Type: TypeBool, SetSession: func(s *SessionVars, val string) error {
s.FastCheckTable = TiDBOptOn(val)
return nil
}},
{Scope: ScopeGlobal | ScopeSession, Name: TiDBSkipMissingPartitionStats, Value: BoolToOnOff(DefTiDBSkipMissingPartitionStats), Type: TypeBool, SetSession: func(s *SessionVars, val string) error {
s.SkipMissingPartitionStats = TiDBOptOn(val)
return nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLAuthMethodName, Value: DefAuthenticationLDAPSASLAuthMethodName, Type: TypeEnum, PossibleValues: []string{ldap.SASLAuthMethodSCRAMSHA1, ldap.SASLAuthMethodSCRAMSHA256, ldap.SASLAuthMethodGSSAPI}, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSASLAuthImpl.SetSASLAuthMethod(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetSASLAuthMethod(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLServerHost, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
// TODO: validate the ip/hostname
ldap.LDAPSASLAuthImpl.SetLDAPServerHost(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetLDAPServerHost(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLServerPort, Value: strconv.Itoa(DefAuthenticationLDAPSASLServerPort), Type: TypeInt, MinValue: 1, MaxValue: math.MaxUint16, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return err
}
ldap.LDAPSASLAuthImpl.SetLDAPServerPort(int(val))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return strconv.Itoa(ldap.LDAPSASLAuthImpl.GetLDAPServerPort()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLTLS, Value: BoolToOnOff(DefAuthenticationLDAPSASLTLS), Type: TypeBool, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSASLAuthImpl.SetEnableTLS(TiDBOptOn(s))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return BoolToOnOff(ldap.LDAPSASLAuthImpl.GetEnableTLS()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLCAPath, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
return ldap.LDAPSASLAuthImpl.SetCAPath(s)
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetCAPath(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLUserSearchAttr, Value: DefAuthenticationLDAPSASLUserSearchAttr, Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
// TODO: validate the ip/hostname
ldap.LDAPSASLAuthImpl.SetSearchAttr(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetSearchAttr(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLBindBaseDN, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSASLAuthImpl.SetBindBaseDN(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetBindBaseDN(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLBindRootDN, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSASLAuthImpl.SetBindRootDN(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetBindRootDN(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLBindRootPWD, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSASLAuthImpl.SetBindRootPW(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSASLAuthImpl.GetBindRootPW(), nil
}},
// TODO: allow setting init_pool_size to 0 to disable pooling
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLInitPoolSize, Value: strconv.Itoa(DefAuthenticationLDAPSASLInitPoolSize), Type: TypeInt, MinValue: 1, MaxValue: 32767, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return err
}
ldap.LDAPSASLAuthImpl.SetInitCapacity(int(val))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return strconv.Itoa(ldap.LDAPSASLAuthImpl.GetInitCapacity()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSASLMaxPoolSize, Value: strconv.Itoa(DefAuthenticationLDAPSASLMaxPoolSize), Type: TypeInt, MinValue: 1, MaxValue: 32767, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return err
}
ldap.LDAPSASLAuthImpl.SetMaxCapacity(int(val))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return strconv.Itoa(ldap.LDAPSASLAuthImpl.GetMaxCapacity()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleAuthMethodName, Value: DefAuthenticationLDAPSimpleAuthMethodName, Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
s = strings.ToUpper(s)
// Only "SIMPLE" is supported
if s != "SIMPLE" {
return errors.Errorf("auth method %s is not supported", s)
}
return nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleServerHost, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
// TODO: validate the ip/hostname
ldap.LDAPSimpleAuthImpl.SetLDAPServerHost(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSimpleAuthImpl.GetLDAPServerHost(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleServerPort, Value: strconv.Itoa(DefAuthenticationLDAPSimpleServerPort), Type: TypeInt, MinValue: 1, MaxValue: math.MaxUint16, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return err
}
ldap.LDAPSimpleAuthImpl.SetLDAPServerPort(int(val))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return strconv.Itoa(ldap.LDAPSimpleAuthImpl.GetLDAPServerPort()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleTLS, Value: BoolToOnOff(DefAuthenticationLDAPSimpleTLS), Type: TypeBool, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSimpleAuthImpl.SetEnableTLS(TiDBOptOn(s))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return BoolToOnOff(ldap.LDAPSimpleAuthImpl.GetEnableTLS()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleCAPath, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
return ldap.LDAPSimpleAuthImpl.SetCAPath(s)
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSimpleAuthImpl.GetCAPath(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleUserSearchAttr, Value: DefAuthenticationLDAPSimpleUserSearchAttr, Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
// TODO: validate the ip/hostname
ldap.LDAPSimpleAuthImpl.SetSearchAttr(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSimpleAuthImpl.GetSearchAttr(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleBindBaseDN, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSimpleAuthImpl.SetBindBaseDN(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSimpleAuthImpl.GetBindBaseDN(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleBindRootDN, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSimpleAuthImpl.SetBindRootDN(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSimpleAuthImpl.GetBindRootDN(), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleBindRootPWD, Value: "", Type: TypeStr, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
ldap.LDAPSimpleAuthImpl.SetBindRootPW(s)
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return ldap.LDAPSimpleAuthImpl.GetBindRootPW(), nil
}},
// TODO: allow setting init_pool_size to 0 to disable pooling
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleInitPoolSize, Value: strconv.Itoa(DefAuthenticationLDAPSimpleInitPoolSize), Type: TypeInt, MinValue: 1, MaxValue: 32767, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return err
}
ldap.LDAPSimpleAuthImpl.SetInitCapacity(int(val))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return strconv.Itoa(ldap.LDAPSimpleAuthImpl.GetInitCapacity()), nil
}},
{Scope: ScopeGlobal, Name: AuthenticationLDAPSimpleMaxPoolSize, Value: strconv.Itoa(DefAuthenticationLDAPSimpleMaxPoolSize), Type: TypeInt, MinValue: 1, MaxValue: 32767, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
val, err := strconv.ParseInt(s, 10, 64)
if err != nil {
return err
}
ldap.LDAPSimpleAuthImpl.SetMaxCapacity(int(val))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return strconv.Itoa(ldap.LDAPSimpleAuthImpl.GetMaxCapacity()), nil
}},
// runtime filter variables group
{Scope: ScopeGlobal | ScopeSession, Name: TiDBRuntimeFilterTypeName, Value: DefRuntimeFilterType, Type: TypeStr,
Validation: func(_ *SessionVars, normalizedValue string, originalValue string, _ ScopeFlag) (string, error) {
_, ok := ToRuntimeFilterType(normalizedValue)
if ok {
return normalizedValue, nil
}
errMsg := fmt.Sprintf("incorrect value: %s. %s should be sepreated by , such as %s, also we only support IN and MIN_MAX now. ",
originalValue, TiDBRuntimeFilterTypeName, DefRuntimeFilterType)
return normalizedValue, errors.New(errMsg)
},
SetSession: func(s *SessionVars, val string) error {
s.runtimeFilterTypes, _ = ToRuntimeFilterType(val)
return nil
},
},
{Scope: ScopeGlobal | ScopeSession, Name: TiDBRuntimeFilterModeName, Value: DefRuntimeFilterMode, Type: TypeStr,
Validation: func(_ *SessionVars, normalizedValue string, originalValue string, _ ScopeFlag) (string, error) {
_, ok := RuntimeFilterModeStringToMode(normalizedValue)
if ok {
return normalizedValue, nil
}
errMsg := fmt.Sprintf("incorrect value: %s. %s options: %s ",
originalValue, TiDBRuntimeFilterModeName, DefRuntimeFilterMode)
return normalizedValue, errors.New(errMsg)
},
SetSession: func(s *SessionVars, val string) error {
s.runtimeFilterMode, _ = RuntimeFilterModeStringToMode(val)
return nil
},
},
{
Scope: ScopeGlobal | ScopeSession,
Name: TiDBLockUnchangedKeys,
Value: BoolToOnOff(DefTiDBLockUnchangedKeys),
Type: TypeBool,
SetSession: func(vars *SessionVars, s string) error {
vars.LockUnchangedKeys = TiDBOptOn(s)
return nil
},
},
{Scope: ScopeGlobal, Name: TiDBEnableCheckConstraint, Value: BoolToOnOff(DefTiDBEnableCheckConstraint), Type: TypeBool, SetGlobal: func(ctx context.Context, vars *SessionVars, s string) error {
EnableCheckConstraint.Store(TiDBOptOn(s))
return nil
}, GetGlobal: func(ctx context.Context, vars *SessionVars) (string, error) {
return BoolToOnOff(EnableCheckConstraint.Load()), nil
}},
}

func setTiFlashComputeDispatchPolicy(s *SessionVars, val string) error {
p, err := tiflashcompute.GetDispatchPolicyByStr(val)
if err != nil {
return err
}
s.TiFlashComputeDispatchPolicy = p
return nil
>>>>>>> a492a371a74 (statistics: merge global stats even if some partition stats are missing (#41176))
}

// FeedbackProbability points to the FeedbackProbability in statistics package.
Expand Down
Loading

0 comments on commit 112c74c

Please sign in to comment.