diff --git a/executor/set_test.go b/executor/set_test.go index 24a6b641b81234..60d0e914ee5db4 100644 --- a/executor/set_test.go +++ b/executor/set_test.go @@ -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'") @@ -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) { diff --git a/sessionctx/variable/session.go b/sessionctx/variable/session.go index d0894b12b44a3b..8cfe1854edef7b 100644 --- a/sessionctx/variable/session.go +++ b/sessionctx/variable/session.go @@ -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 ( diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 56a2b091654530..2aa84c92ba784e 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -2306,235 +2306,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. diff --git a/sessionctx/variable/tidb_vars.go b/sessionctx/variable/tidb_vars.go index 84a367c0409016..297889a140549b 100644 --- a/sessionctx/variable/tidb_vars.go +++ b/sessionctx/variable/tidb_vars.go @@ -910,84 +910,10 @@ const ( PasswordReuseHistory = "password_history" // PasswordReuseTime limit how long passwords can be reused. PasswordReuseTime = "password_reuse_interval" -<<<<<<< HEAD -======= - // TiDBHistoricalStatsDuration indicates the duration to remain tidb historical stats - TiDBHistoricalStatsDuration = "tidb_historical_stats_duration" - // TiDBEnableHistoricalStatsForCapture indicates whether use historical stats in plan replayer capture - TiDBEnableHistoricalStatsForCapture = "tidb_enable_historical_stats_for_capture" - // TiDBEnableResourceControl indicates whether resource control feature is enabled - TiDBEnableResourceControl = "tidb_enable_resource_control" - // TiDBStmtSummaryEnablePersistent indicates whether to enable file persistence for stmtsummary. - TiDBStmtSummaryEnablePersistent = "tidb_stmt_summary_enable_persistent" - // TiDBStmtSummaryFilename indicates the file name written by stmtsummary. - TiDBStmtSummaryFilename = "tidb_stmt_summary_filename" - // TiDBStmtSummaryFileMaxDays indicates how many days the files written by stmtsummary will be kept. - TiDBStmtSummaryFileMaxDays = "tidb_stmt_summary_file_max_days" - // TiDBStmtSummaryFileMaxSize indicates the maximum size (in mb) of a single file written by stmtsummary. - TiDBStmtSummaryFileMaxSize = "tidb_stmt_summary_file_max_size" - // TiDBStmtSummaryFileMaxBackups indicates the maximum number of files written by stmtsummary. - TiDBStmtSummaryFileMaxBackups = "tidb_stmt_summary_file_max_backups" - // TiDBTTLRunningTasks limits the count of running ttl tasks. Default to 0, means 3 times the count of TiKV (or no - // limitation, if the storage is not TiKV). - TiDBTTLRunningTasks = "tidb_ttl_running_tasks" - // AuthenticationLDAPSASLAuthMethodName defines the authentication method used by LDAP SASL authentication plugin - AuthenticationLDAPSASLAuthMethodName = "authentication_ldap_sasl_auth_method_name" - // AuthenticationLDAPSASLCAPath defines the ca certificate to verify LDAP connection in LDAP SASL authentication plugin - AuthenticationLDAPSASLCAPath = "authentication_ldap_sasl_ca_path" - // AuthenticationLDAPSASLTLS defines whether to use TLS connection in LDAP SASL authentication plugin - AuthenticationLDAPSASLTLS = "authentication_ldap_sasl_tls" - // AuthenticationLDAPSASLServerHost defines the server host of LDAP server for LDAP SASL authentication plugin - AuthenticationLDAPSASLServerHost = "authentication_ldap_sasl_server_host" - // AuthenticationLDAPSASLServerPort defines the port of LDAP server for LDAP SASL authentication plugin - AuthenticationLDAPSASLServerPort = "authentication_ldap_sasl_server_port" - // AuthenticationLDAPSASLReferral defines whether to enable LDAP referral for LDAP SASL authentication plugin - AuthenticationLDAPSASLReferral = "authentication_ldap_sasl_referral" - // AuthenticationLDAPSASLUserSearchAttr defines the attribute of username in LDAP server - AuthenticationLDAPSASLUserSearchAttr = "authentication_ldap_sasl_user_search_attr" - // AuthenticationLDAPSASLBindBaseDN defines the `dn` to search the users in. It's used to limit the search scope of TiDB. - AuthenticationLDAPSASLBindBaseDN = "authentication_ldap_sasl_bind_base_dn" - // AuthenticationLDAPSASLBindRootDN defines the `dn` of the user to login the LDAP server and perform search. - AuthenticationLDAPSASLBindRootDN = "authentication_ldap_sasl_bind_root_dn" - // AuthenticationLDAPSASLBindRootPWD defines the password of the user to login the LDAP server and perform search. - AuthenticationLDAPSASLBindRootPWD = "authentication_ldap_sasl_bind_root_pwd" - // AuthenticationLDAPSASLInitPoolSize defines the init size of connection pool to LDAP server for SASL plugin. - AuthenticationLDAPSASLInitPoolSize = "authentication_ldap_sasl_init_pool_size" - // AuthenticationLDAPSASLMaxPoolSize defines the max size of connection pool to LDAP server for SASL plugin. - AuthenticationLDAPSASLMaxPoolSize = "authentication_ldap_sasl_max_pool_size" - // AuthenticationLDAPSimpleAuthMethodName defines the authentication method used by LDAP Simple authentication plugin - AuthenticationLDAPSimpleAuthMethodName = "authentication_ldap_simple_auth_method_name" - // AuthenticationLDAPSimpleCAPath defines the ca certificate to verify LDAP connection in LDAP Simple authentication plugin - AuthenticationLDAPSimpleCAPath = "authentication_ldap_simple_ca_path" - // AuthenticationLDAPSimpleTLS defines whether to use TLS connection in LDAP Simple authentication plugin - AuthenticationLDAPSimpleTLS = "authentication_ldap_simple_tls" - // AuthenticationLDAPSimpleServerHost defines the server host of LDAP server for LDAP Simple authentication plugin - AuthenticationLDAPSimpleServerHost = "authentication_ldap_simple_server_host" - // AuthenticationLDAPSimpleServerPort defines the port of LDAP server for LDAP Simple authentication plugin - AuthenticationLDAPSimpleServerPort = "authentication_ldap_simple_server_port" - // AuthenticationLDAPSimpleReferral defines whether to enable LDAP referral for LDAP Simple authentication plugin - AuthenticationLDAPSimpleReferral = "authentication_ldap_simple_referral" - // AuthenticationLDAPSimpleUserSearchAttr defines the attribute of username in LDAP server - AuthenticationLDAPSimpleUserSearchAttr = "authentication_ldap_simple_user_search_attr" - // AuthenticationLDAPSimpleBindBaseDN defines the `dn` to search the users in. It's used to limit the search scope of TiDB. - AuthenticationLDAPSimpleBindBaseDN = "authentication_ldap_simple_bind_base_dn" - // AuthenticationLDAPSimpleBindRootDN defines the `dn` of the user to login the LDAP server and perform search. - AuthenticationLDAPSimpleBindRootDN = "authentication_ldap_simple_bind_root_dn" - // AuthenticationLDAPSimpleBindRootPWD defines the password of the user to login the LDAP server and perform search. - AuthenticationLDAPSimpleBindRootPWD = "authentication_ldap_simple_bind_root_pwd" - // AuthenticationLDAPSimpleInitPoolSize defines the init size of connection pool to LDAP server for SASL plugin. - AuthenticationLDAPSimpleInitPoolSize = "authentication_ldap_simple_init_pool_size" - // AuthenticationLDAPSimpleMaxPoolSize defines the max size of connection pool to LDAP server for SASL plugin. - AuthenticationLDAPSimpleMaxPoolSize = "authentication_ldap_simple_max_pool_size" - // TiDBRuntimeFilterTypeName the value of is string, a runtime filter type list split by ",", such as: "IN,MIN_MAX" - TiDBRuntimeFilterTypeName = "tidb_runtime_filter_type" - // TiDBRuntimeFilterModeName the mode of runtime filter, such as "OFF", "LOCAL" - TiDBRuntimeFilterModeName = "tidb_runtime_filter_mode" // TiDBSkipMissingPartitionStats 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. TiDBSkipMissingPartitionStats = "tidb_skip_missing_partition_stats" ->>>>>>> a492a371a74 (statistics: merge global stats even if some partition stats are missing (#41176)) ) // TiDB intentional limits @@ -1225,7 +1151,6 @@ const ( DefTiDBServerMemoryLimitGCTrigger = 0.7 DefTiDBEnableGOGCTuner = true // DefTiDBGOGCTunerThreshold is to limit TiDBGOGCTunerThreshold. -<<<<<<< HEAD DefTiDBGOGCTunerThreshold float64 = 0.6 DefTiDBOptPrefixIndexSingleScan = true DefTiDBExternalTS = 0 @@ -1250,65 +1175,7 @@ const ( DefTiDBTTLJobScheduleWindowEndTime = "23:59 +0000" DefTiDBTTLScanWorkerCount = 4 DefTiDBTTLDeleteWorkerCount = 4 -======= - DefTiDBGOGCTunerThreshold float64 = 0.6 - DefTiDBOptPrefixIndexSingleScan = true - DefTiDBExternalTS = 0 - DefTiDBEnableExternalTSRead = false - DefTiDBEnableReusechunk = true - DefTiDBUseAlloc = false - DefTiDBEnablePlanReplayerCapture = true - DefTiDBIndexMergeIntersectionConcurrency = ConcurrencyUnset - DefTiDBTTLJobEnable = true - DefTiDBTTLScanBatchSize = 500 - DefTiDBTTLScanBatchMaxSize = 10240 - DefTiDBTTLScanBatchMinSize = 1 - DefTiDBTTLDeleteBatchSize = 100 - DefTiDBTTLDeleteBatchMaxSize = 10240 - DefTiDBTTLDeleteBatchMinSize = 1 - DefTiDBTTLDeleteRateLimit = 0 - DefTiDBTTLRunningTasks = -1 - DefPasswordReuseHistory = 0 - DefPasswordReuseTime = 0 - DefTiDBStoreBatchSize = 4 - DefTiDBHistoricalStatsDuration = 7 * 24 * time.Hour - DefTiDBEnableHistoricalStatsForCapture = false - DefTiDBTTLJobScheduleWindowStartTime = "00:00 +0000" - DefTiDBTTLJobScheduleWindowEndTime = "23:59 +0000" - DefTiDBTTLScanWorkerCount = 4 - DefTiDBTTLDeleteWorkerCount = 4 - DefaultExchangeCompressionMode = kv.ExchangeCompressionModeUnspecified - DefTiDBEnableResourceControl = true - DefTiDBPessimisticTransactionFairLocking = false - DefTiDBEnablePlanCacheForParamLimit = true - DefTiFlashComputeDispatchPolicy = tiflashcompute.DispatchPolicyConsistentHashStr - DefTiDBEnablePlanCacheForSubquery = true - DefTiDBLoadBasedReplicaReadThreshold = time.Second - DefTiDBOptEnableLateMaterialization = true - DefTiDBOptOrderingIdxSelThresh = 0.0 - DefTiDBOptEnableMPPSharedCTEExecution = false - DefTiDBPlanCacheInvalidationOnFreshStats = true - DefTiDBEnableRowLevelChecksum = false - DefAuthenticationLDAPSASLAuthMethodName = "SCRAM-SHA-1" - DefAuthenticationLDAPSASLServerPort = 389 - DefAuthenticationLDAPSASLTLS = false - DefAuthenticationLDAPSASLUserSearchAttr = "uid" - DefAuthenticationLDAPSASLInitPoolSize = 10 - DefAuthenticationLDAPSASLMaxPoolSize = 1000 - DefAuthenticationLDAPSimpleAuthMethodName = "SIMPLE" - DefAuthenticationLDAPSimpleServerPort = 389 - DefAuthenticationLDAPSimpleTLS = false - DefAuthenticationLDAPSimpleUserSearchAttr = "uid" - DefAuthenticationLDAPSimpleInitPoolSize = 10 - DefAuthenticationLDAPSimpleMaxPoolSize = 1000 - DefTiFlashReplicaRead = tiflash.AllReplicaStr - DefTiDBEnableFastCheckTable = true - DefRuntimeFilterType = "IN" - DefRuntimeFilterMode = "OFF" - DefTiDBLockUnchangedKeys = true - DefTiDBEnableCheckConstraint = false - DefTiDBSkipMissingPartitionStats = true ->>>>>>> a492a371a74 (statistics: merge global stats even if some partition stats are missing (#41176)) + DefTiDBSkipMissingPartitionStats = true ) // Process global variables. @@ -1375,7 +1242,6 @@ var ( TTLScanBatchSize = atomic.NewInt64(DefTiDBTTLScanBatchSize) TTLDeleteBatchSize = atomic.NewInt64(DefTiDBTTLDeleteBatchSize) TTLDeleteRateLimit = atomic.NewInt64(DefTiDBTTLDeleteRateLimit) -<<<<<<< HEAD TTLJobRunInterval = atomic.NewDuration(mustParseDuration(DefTiDBTTLJobRunInterval)) TTLJobScheduleWindowStartTime = atomic.NewTime(mustParseTime(FullDayTimeFormat, DefTiDBTTLJobScheduleWindowStartTime)) TTLJobScheduleWindowEndTime = atomic.NewTime(mustParseTime(FullDayTimeFormat, DefTiDBTTLJobScheduleWindowEndTime)) @@ -1385,34 +1251,7 @@ var ( PasswordReuseInterval = atomic.NewInt64(DefPasswordReuseTime) IsSandBoxModeEnabled = atomic.NewBool(false) MaxPreparedStmtCountValue = atomic.NewInt64(DefMaxPreparedStmtCount) -======= - TTLJobScheduleWindowStartTime = atomic.NewTime( - mustParseTime( - FullDayTimeFormat, - DefTiDBTTLJobScheduleWindowStartTime, - ), - ) - TTLJobScheduleWindowEndTime = atomic.NewTime( - mustParseTime( - FullDayTimeFormat, - DefTiDBTTLJobScheduleWindowEndTime, - ), - ) - TTLScanWorkerCount = atomic.NewInt32(DefTiDBTTLScanWorkerCount) - TTLDeleteWorkerCount = atomic.NewInt32(DefTiDBTTLDeleteWorkerCount) - PasswordHistory = atomic.NewInt64(DefPasswordReuseHistory) - PasswordReuseInterval = atomic.NewInt64(DefPasswordReuseTime) - IsSandBoxModeEnabled = atomic.NewBool(false) - MaxPreparedStmtCountValue = atomic.NewInt64(DefMaxPreparedStmtCount) - HistoricalStatsDuration = atomic.NewDuration(DefTiDBHistoricalStatsDuration) - EnableHistoricalStatsForCapture = atomic.NewBool(DefTiDBEnableHistoricalStatsForCapture) - TTLRunningTasks = atomic.NewInt32(DefTiDBTTLRunningTasks) - // always set the default value to false because the resource control in kv-client is not inited - // It will be initialized to the right value after the first call of `rebuildSysVarCache` - EnableResourceControl = atomic.NewBool(false) - EnableCheckConstraint = atomic.NewBool(DefTiDBEnableCheckConstraint) - SkipMissingPartitionStats = atomic.NewBool(DefTiDBSkipMissingPartitionStats) ->>>>>>> a492a371a74 (statistics: merge global stats even if some partition stats are missing (#41176)) + SkipMissingPartitionStats = atomic.NewBool(DefTiDBSkipMissingPartitionStats) ) var ( diff --git a/statistics/handle/handle.go b/statistics/handle/handle.go index 66f04330233a84..0a0f6298cb25da 100644 --- a/statistics/handle/handle.go +++ b/statistics/handle/handle.go @@ -761,7 +761,7 @@ func (h *Handle) mergePartitionStats2GlobalStats(sc sessionctx.Context, skipMissingPartitionStats := sc.GetSessionVars().SkipMissingPartitionStats if sc.GetSessionVars().InRestrictedSQL { // For AutoAnalyze and HandleDDLEvent(ActionDropTablePartition), we need to use @@global.tidb_skip_missing_partition_stats - val, err1 := sc.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBAnalyzeSkipColumnTypes) + val, err1 := sc.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(variable.TiDBSkipMissingPartitionStats) if err1 != nil { logutil.BgLogger().Error("loading tidb_skip_missing_partition_stats failed", zap.Error(err1)) err = err1