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

config: enable collect execution information by default (#18415) #18518

Merged
merged 8 commits into from
Jul 14, 2020
Next Next commit
cherry pick #18415 to release-4.0
Signed-off-by: ti-srebot <[email protected]>
crazycs520 authored and ti-srebot committed Jul 13, 2020
commit ebec1ecae0f4284d38732a3dbe4203297c1efc39
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
@@ -681,7 +681,7 @@ var defaultConf = Config{
AllowAutoRandom: false,
AllowsExpressionIndex: false,
},
EnableCollectExecutionInfo: false,
EnableCollectExecutionInfo: true,
EnableTelemetry: true,
}

2 changes: 1 addition & 1 deletion distsql/select_result.go
Original file line number Diff line number Diff line change
@@ -235,7 +235,7 @@ func (r *selectResult) readFromChunk(ctx context.Context, chk *chunk.Chunk) erro

func (r *selectResult) updateCopRuntimeStats(detail *execdetails.ExecDetails, respTime time.Duration) {
callee := detail.CalleeAddress
if r.ctx.GetSessionVars().StmtCtx.RuntimeStatsColl == nil || callee == "" {
if r.rootPlanID == nil || r.ctx.GetSessionVars().StmtCtx.RuntimeStatsColl == nil || callee == "" {
return
}
if len(r.selectResp.GetExecutionSummaries()) != len(r.copPlanIDs) {
1 change: 1 addition & 0 deletions infoschema/tables_test.go
Original file line number Diff line number Diff line change
@@ -880,6 +880,7 @@ func (s *testTableSuite) TestSelectHiddenColumn(c *C) {
func (s *testTableSuite) TestStmtSummaryTable(c *C) {
tk := s.newTestKitWithRoot(c)

tk.MustExec("set @@tidb_enable_collect_execution_info=0;")
tk.MustQuery("select column_comment from information_schema.columns " +
"where table_name='STATEMENTS_SUMMARY' and column_name='STMT_TYPE'",
).Check(testkit.Rows("Statement type"))
6 changes: 6 additions & 0 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
@@ -720,6 +720,12 @@ var defaultSysVars = []*SysVar{
{ScopeSession, TiDBQueryLogMaxLen, strconv.Itoa(logutil.DefaultQueryLogMaxLen)},
{ScopeSession, TiDBCheckMb4ValueInUTF8, BoolToIntStr(config.GetGlobalConfig().CheckMb4ValueInUTF8)},
{ScopeSession, TiDBFoundInPlanCache, BoolToIntStr(DefTiDBFoundInPlanCache)},
<<<<<<< HEAD
=======
{ScopeSession, TiDBEnableCollectExecutionInfo, BoolToIntStr(DefTiDBEnableCollectExecutionInfo)},
{ScopeSession, TiDBAllowAutoRandExplicitInsert, boolToOnOff(DefTiDBAllowAutoRandExplicitInsert)},
{ScopeGlobal | ScopeSession, TiDBEnableClusteredIndex, BoolToIntStr(DefTiDBEnableClusteredIndex)},
>>>>>>> 5574e1a... config: enable collect execution information by default (#18415)
{ScopeGlobal, TiDBSlowLogMasking, BoolToIntStr(DefTiDBSlowLogMasking)},
{ScopeSession, TiDBEnableCollectExecutionInfo, BoolToIntStr(DefTiDBEnableCollectExecutionInfo)},
{ScopeGlobal, TiDBEnableTelemetry, BoolToIntStr(DefTiDBEnableTelemetry)},
6 changes: 6 additions & 0 deletions sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
@@ -492,6 +492,12 @@ const (
DefTiDBMetricSchemaStep = 60 // 60s
DefTiDBMetricSchemaRangeDuration = 60 // 60s
DefTiDBFoundInPlanCache = false
<<<<<<< HEAD
=======
DefTiDBEnableCollectExecutionInfo = true
DefTiDBAllowAutoRandExplicitInsert = false
DefTiDBEnableClusteredIndex = false
>>>>>>> 5574e1a... config: enable collect execution information by default (#18415)
DefTiDBSlowLogMasking = false
DefTiDBEnableCollectExecutionInfo = false
DefTiDBEnableTelemetry = true