Skip to content

Commit

Permalink
cherry pick pingcap#18415 to release-4.0
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
crazycs520 authored and ti-srebot committed Jul 13, 2020
1 parent 9848ee7 commit ebec1ec
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ var defaultConf = Config{
AllowAutoRandom: false,
AllowsExpressionIndex: false,
},
EnableCollectExecutionInfo: false,
EnableCollectExecutionInfo: true,
EnableTelemetry: true,
}

Expand Down
2 changes: 1 addition & 1 deletion distsql/select_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions infoschema/tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
6 changes: 6 additions & 0 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
6 changes: 6 additions & 0 deletions sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ebec1ec

Please sign in to comment.