Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#41336
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
AstroProfundis authored and ti-chi-bot committed Feb 15, 2023
1 parent df32e3a commit 646cf92
Show file tree
Hide file tree
Showing 8 changed files with 357 additions and 47 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ var defaultConf = Config{
EnableGlobalKill: false,
},
EnableCollectExecutionInfo: true,
EnableTelemetry: true,
EnableTelemetry: false,
Labels: make(map[string]string),
EnableGlobalIndex: false,
Security: Security{
Expand Down
2 changes: 1 addition & 1 deletion config/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ skip-register-to-dashboard = false
# When enabled, usage data (for example, instance versions) will be reported to PingCAP periodically for user experience analytics.
# If this config is set to `false` on all TiDB servers, telemetry will be always disabled regardless of the value of the global variable `tidb_enable_telemetry`.
# See PingCAP privacy policy for details: https://pingcap.com/en/privacy-policy/
enable-telemetry = true
enable-telemetry = false

# deprecate-integer-display-length is used to be compatible with MySQL 8.0 in which the integer declared with display length will be returned with
# a warning like `Integer display width is deprecated and will be removed in a future release`.
Expand Down
8 changes: 4 additions & 4 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,23 +352,23 @@ mem-profile-interval="1m"`)
require.NoError(t, err)
require.NoError(t, f.Sync())
require.NoError(t, conf.Load(configFile))
require.True(t, conf.EnableTelemetry)
require.False(t, conf.EnableTelemetry)

_, err = f.WriteString(`
enable-table-lock = true
`)
require.NoError(t, err)
require.NoError(t, f.Sync())
require.NoError(t, conf.Load(configFile))
require.True(t, conf.EnableTelemetry)
require.False(t, conf.EnableTelemetry)

_, err = f.WriteString(`
enable-telemetry = false
enable-telemetry = true
`)
require.NoError(t, err)
require.NoError(t, f.Sync())
require.NoError(t, conf.Load(configFile))
require.False(t, conf.EnableTelemetry)
require.True(t, conf.EnableTelemetry)

_, err = f.WriteString(`
[security]
Expand Down
8 changes: 8 additions & 0 deletions privilege/privileges/privileges_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,15 @@ func TestSecurityEnhancedModeSysVars(t *testing.T) {
}, nil, nil)

tk.MustQuery(`SHOW VARIABLES LIKE 'tidb_force_priority'`).Check(testkit.Rows("tidb_force_priority NO_PRIORITY"))
<<<<<<< HEAD
tk.MustQuery(`SHOW GLOBAL VARIABLES LIKE 'tidb_enable_telemetry'`).Check(testkit.Rows("tidb_enable_telemetry ON"))
=======
tk.MustQuery(`SELECT COUNT(*) FROM information_schema.variables_info WHERE variable_name = 'tidb_top_sql_max_meta_count'`).Check(testkit.Rows("1"))
tk.MustQuery(`SELECT COUNT(*) FROM performance_schema.session_variables WHERE variable_name = 'tidb_top_sql_max_meta_count'`).Check(testkit.Rows("1"))
tk.MustQuery(`SHOW GLOBAL VARIABLES LIKE 'tidb_enable_telemetry'`).Check(testkit.Rows("tidb_enable_telemetry OFF"))
tk.MustQuery(`SELECT COUNT(*) FROM information_schema.variables_info WHERE variable_name = 'tidb_enable_telemetry'`).Check(testkit.Rows("1"))
tk.MustQuery(`SELECT COUNT(*) FROM performance_schema.session_variables WHERE variable_name = 'tidb_enable_telemetry'`).Check(testkit.Rows("1"))
>>>>>>> dde0c6c8495 (telemetry: set switch default to false (#41336))

// should not actually make any change.
tk.MustExec("SET tidb_force_priority = 'NO_PRIORITY'")
Expand Down
253 changes: 253 additions & 0 deletions sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ const (

// Default TiDB system variable values.
const (
<<<<<<< HEAD
DefHostname = "localhost"
DefIndexLookupConcurrency = ConcurrencyUnset
DefIndexLookupJoinConcurrency = ConcurrencyUnset
Expand Down Expand Up @@ -799,6 +800,258 @@ const (
DefTiDBEnableColumnTracking = false
DefTiDBStatsLoadSyncWait = 0
DefTiDBStatsLoadPseudoTimeout = false
=======
DefHostname = "localhost"
DefIndexLookupConcurrency = ConcurrencyUnset
DefIndexLookupJoinConcurrency = ConcurrencyUnset
DefIndexSerialScanConcurrency = 1
DefIndexJoinBatchSize = 25000
DefIndexLookupSize = 20000
DefDistSQLScanConcurrency = 15
DefBuildStatsConcurrency = 4
DefAutoAnalyzeRatio = 0.5
DefAutoAnalyzeStartTime = "00:00 +0000"
DefAutoAnalyzeEndTime = "23:59 +0000"
DefAutoIncrementIncrement = 1
DefAutoIncrementOffset = 1
DefChecksumTableConcurrency = 4
DefSkipUTF8Check = false
DefSkipASCIICheck = false
DefOptAggPushDown = false
DefOptCartesianBCJ = 1
DefOptMPPOuterJoinFixedBuildSide = false
DefOptWriteRowID = false
DefOptEnableCorrelationAdjustment = true
DefOptLimitPushDownThreshold = 100
DefOptCorrelationThreshold = 0.9
DefOptCorrelationExpFactor = 1
DefOptCPUFactor = 3.0
DefOptCopCPUFactor = 3.0
DefOptTiFlashConcurrencyFactor = 24.0
DefOptNetworkFactor = 1.0
DefOptScanFactor = 1.5
DefOptDescScanFactor = 3.0
DefOptSeekFactor = 20.0
DefOptMemoryFactor = 0.001
DefOptDiskFactor = 1.5
DefOptConcurrencyFactor = 3.0
DefOptForceInlineCTE = false
DefOptInSubqToJoinAndAgg = true
DefOptPreferRangeScan = false
DefBatchInsert = false
DefBatchDelete = false
DefBatchCommit = false
DefCurretTS = 0
DefInitChunkSize = 32
DefMinPagingSize = int(paging.MinPagingSize)
DefMaxPagingSize = int(paging.MaxPagingSize)
DefMaxChunkSize = 1024
DefDMLBatchSize = 0
DefMaxPreparedStmtCount = -1
DefWaitTimeout = 28800
DefTiDBMemQuotaApplyCache = 32 << 20 // 32MB.
DefTiDBMemQuotaBindingCache = 64 << 20 // 64MB.
DefTiDBGeneralLog = false
DefTiDBPProfSQLCPU = 0
DefTiDBRetryLimit = 10
DefTiDBDisableTxnAutoRetry = true
DefTiDBConstraintCheckInPlace = false
DefTiDBHashJoinConcurrency = ConcurrencyUnset
DefTiDBProjectionConcurrency = ConcurrencyUnset
DefBroadcastJoinThresholdSize = 100 * 1024 * 1024
DefBroadcastJoinThresholdCount = 10 * 1024
DefTiDBOptimizerSelectivityLevel = 0
DefTiDBOptimizerEnableNewOFGB = false
DefTiDBEnableOuterJoinReorder = true
DefTiDBEnableNAAJ = false
DefTiDBAllowBatchCop = 1
DefTiDBAllowMPPExecution = true
DefTiDBHashExchangeWithNewCollation = true
DefTiDBEnforceMPPExecution = false
DefTiFlashMaxThreads = -1
DefTiDBMPPStoreFailTTL = "60s"
DefTiDBTxnMode = ""
DefTiDBRowFormatV1 = 1
DefTiDBRowFormatV2 = 2
DefTiDBDDLReorgWorkerCount = 4
DefTiDBDDLReorgBatchSize = 256
DefTiDBDDLFlashbackConcurrency = 64
DefTiDBDDLErrorCountLimit = 512
DefTiDBMaxDeltaSchemaCount = 1024
DefTiDBPlacementMode = PlacementModeStrict
DefTiDBEnableAutoIncrementInGenerated = false
DefTiDBHashAggPartialConcurrency = ConcurrencyUnset
DefTiDBHashAggFinalConcurrency = ConcurrencyUnset
DefTiDBWindowConcurrency = ConcurrencyUnset
DefTiDBMergeJoinConcurrency = 1 // disable optimization by default
DefTiDBStreamAggConcurrency = 1
DefTiDBForcePriority = mysql.NoPriority
DefEnableWindowFunction = true
DefEnablePipelinedWindowFunction = true
DefEnableStrictDoubleTypeCheck = true
DefEnableVectorizedExpression = true
DefTiDBOptJoinReorderThreshold = 0
DefTiDBDDLSlowOprThreshold = 300
DefTiDBUseFastAnalyze = false
DefTiDBSkipIsolationLevelCheck = false
DefTiDBExpensiveQueryTimeThreshold = 60 // 60s
DefTiDBScatterRegion = false
DefTiDBWaitSplitRegionFinish = true
DefWaitSplitRegionTimeout = 300 // 300s
DefTiDBEnableNoopFuncs = Off
DefTiDBEnableNoopVariables = true
DefTiDBAllowRemoveAutoInc = false
DefTiDBUsePlanBaselines = true
DefTiDBEvolvePlanBaselines = false
DefTiDBEvolvePlanTaskMaxTime = 600 // 600s
DefTiDBEvolvePlanTaskStartTime = "00:00 +0000"
DefTiDBEvolvePlanTaskEndTime = "23:59 +0000"
DefInnodbLockWaitTimeout = 50 // 50s
DefTiDBStoreLimit = 0
DefTiDBMetricSchemaStep = 60 // 60s
DefTiDBMetricSchemaRangeDuration = 60 // 60s
DefTiDBFoundInPlanCache = false
DefTiDBFoundInBinding = false
DefTiDBEnableCollectExecutionInfo = true
DefTiDBAllowAutoRandExplicitInsert = false
DefTiDBEnableClusteredIndex = ClusteredIndexDefModeOn
DefTiDBRedactLog = false
DefTiDBRestrictedReadOnly = false
DefTiDBSuperReadOnly = false
DefTiDBShardAllocateStep = math.MaxInt64
DefTiDBEnableTelemetry = false
DefTiDBEnableParallelApply = false
DefTiDBPartitionPruneMode = "dynamic"
DefTiDBEnableRateLimitAction = false
DefTiDBEnableAsyncCommit = false
DefTiDBEnable1PC = false
DefTiDBGuaranteeLinearizability = true
DefTiDBAnalyzeVersion = 2
DefTiDBAutoAnalyzePartitionBatchSize = 1
DefTiDBEnableIndexMergeJoin = false
DefTiDBTrackAggregateMemoryUsage = true
DefTiDBEnableExchangePartition = true
DefCTEMaxRecursionDepth = 1000
DefTiDBTmpTableMaxSize = 64 << 20 // 64MB.
DefTiDBEnableLocalTxn = false
DefTiDBTSOClientBatchMaxWaitTime = 0.0 // 0ms
DefTiDBEnableTSOFollowerProxy = false
DefTiDBEnableOrderedResultMode = false
DefTiDBEnablePseudoForOutdatedStats = false
DefTiDBRegardNULLAsPoint = true
DefEnablePlacementCheck = true
DefTimestamp = "0"
DefTimestampFloat = 0.0
DefTiDBEnableStmtSummary = true
DefTiDBStmtSummaryInternalQuery = false
DefTiDBStmtSummaryRefreshInterval = 1800
DefTiDBStmtSummaryHistorySize = 24
DefTiDBStmtSummaryMaxStmtCount = 3000
DefTiDBStmtSummaryMaxSQLLength = 4096
DefTiDBCapturePlanBaseline = Off
DefTiDBEnableIndexMerge = true
DefEnableLegacyInstanceScope = true
DefTiDBTableCacheLease = 3 // 3s
DefTiDBPersistAnalyzeOptions = true
DefTiDBEnableColumnTracking = false
DefTiDBStatsLoadSyncWait = 100
DefTiDBStatsLoadPseudoTimeout = true
DefSysdateIsNow = false
DefTiDBEnableMutationChecker = false
DefTiDBTxnAssertionLevel = AssertionOffStr
DefTiDBIgnorePreparedCacheCloseStmt = false
DefTiDBBatchPendingTiFlashCount = 4000
DefRCReadCheckTS = false
DefTiDBRemoveOrderbyInSubquery = false
DefTiDBSkewDistinctAgg = false
DefTiDB3StageDistinctAgg = true
DefTiDBReadStaleness = 0
DefTiDBGCMaxWaitTime = 24 * 60 * 60
DefMaxAllowedPacket uint64 = 67108864
DefTiDBEnableBatchDML = false
DefTiDBMemQuotaQuery = 1073741824 // 1GB
DefTiDBStatsCacheMemQuota = 0
MaxTiDBStatsCacheMemQuota = 1024 * 1024 * 1024 * 1024 // 1TB
DefTiDBQueryLogMaxLen = 4096
DefRequireSecureTransport = false
DefTiDBCommitterConcurrency = 128
DefTiDBBatchDMLIgnoreError = false
DefTiDBMemQuotaAnalyze = -1
DefTiDBEnableAutoAnalyze = true
DefTiDBMemOOMAction = "CANCEL"
DefTiDBMaxAutoAnalyzeTime = 12 * 60 * 60
DefTiDBEnablePrepPlanCache = true
DefTiDBPrepPlanCacheSize = 100
DefTiDBEnablePrepPlanCacheMemoryMonitor = true
DefTiDBPrepPlanCacheMemoryGuardRatio = 0.1
DefTiDBDDLEnableDistributeReorg = distributereorg.TiDBEnableDistributeReorg
DefTiDBSimplifiedMetrics = false
DefTiDBEnablePaging = true
DefTiFlashFineGrainedShuffleStreamCount = 0
DefStreamCountWhenMaxThreadsNotSet = 8
DefTiFlashFineGrainedShuffleBatchSize = 8192
DefAdaptiveClosestReadThreshold = 4096
DefTiDBEnableAnalyzeSnapshot = false
DefTiDBGenerateBinaryPlan = true
DefEnableTiDBGCAwareMemoryTrack = false
DefTiDBDefaultStrMatchSelectivity = 0.8
DefTiDBEnableTmpStorageOnOOM = true
DefTiDBEnableMDL = true
DefTiFlashFastScan = false
DefMemoryUsageAlarmRatio = 0.7
DefMemoryUsageAlarmKeepRecordNum = 5
DefTiDBEnableFastReorg = true
DefTiDBDDLDiskQuota = 100 * 1024 * 1024 * 1024 // 100GB
DefExecutorConcurrency = 5
DefTiDBEnableNonPreparedPlanCache = false
DefTiDBNonPreparedPlanCacheSize = 100
DefTiDBEnableTiFlashReadForWriteStmt = false
// MaxDDLReorgBatchSize is exported for testing.
MaxDDLReorgBatchSize int32 = 10240
MinDDLReorgBatchSize int32 = 32
MinExpensiveQueryTimeThreshold uint64 = 10 // 10s
DefTiDBAutoBuildStatsConcurrency = 1
DefTiDBSysProcScanConcurrency = 1
DefTiDBRcWriteCheckTs = false
DefTiDBForeignKeyChecks = true
DefTiDBAnalyzePartitionConcurrency = 1
DefTiDBOptRangeMaxSize = 64 * int64(size.MB) // 64 MB
DefTiDBCostModelVer = 2
DefTiDBServerMemoryLimitSessMinSize = 128 << 20
DefTiDBMergePartitionStatsConcurrency = 1
DefTiDBServerMemoryLimitGCTrigger = 0.7
DefTiDBEnableGOGCTuner = true
// DefTiDBGOGCTunerThreshold is to limit TiDBGOGCTunerThreshold.
DefTiDBGOGCTunerThreshold float64 = 0.6
DefTiDBOptPrefixIndexSingleScan = true
DefTiDBExternalTS = 0
DefTiDBEnableExternalTSRead = false
DefTiDBEnableReusechunk = true
DefTiDBUseAlloc = false
DefTiDBEnablePlanReplayerCapture = false
DefTiDBIndexMergeIntersectionConcurrency = ConcurrencyUnset
DefTiDBTTLJobEnable = true
DefTiDBTTLScanBatchSize = 500
DefTiDBTTLScanBatchMaxSize = 10240
DefTiDBTTLScanBatchMinSize = 1
DefTiDBTTLDeleteBatchSize = 100
DefTiDBTTLDeleteBatchMaxSize = 10240
DefTiDBTTLDeleteBatchMinSize = 1
DefTiDBTTLDeleteRateLimit = 0
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 = false
DefTiDBPessimisticTransactionAggressiveLocking = false
DefTiDBEnablePlanCacheForParamLimit = true
>>>>>>> dde0c6c8495 (telemetry: set switch default to false (#41336))
)

// Process global variables.
Expand Down
20 changes: 20 additions & 0 deletions telemetry/cte_test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "cte_test_test",
timeout = "short",
srcs = ["cte_test.go"],
flaky = True,
race = "on",
deps = [
"//domain",
"//kv",
"//session",
"//store/mockstore",
"//testkit/testsetup",
"@com_github_stretchr_testify//require",
"@io_etcd_go_etcd_tests_v3//integration",
"@io_opencensus_go//stats/view",
"@org_uber_go_goleak//:goleak",
],
)

0 comments on commit 646cf92

Please sign in to comment.