Skip to content

Commit

Permalink
Revert "This is an automated cherry-pick of pingcap#50915"
Browse files Browse the repository at this point in the history
This reverts commit d746169.
  • Loading branch information
winoros committed Nov 11, 2024
1 parent d746169 commit e011549
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 1,242 deletions.
15 changes: 9 additions & 6 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (a *ExecStmt) PointGet(ctx context.Context) (*recordSet, error) {
if raw, ok := sctx.(processinfoSetter); ok {
pi = raw
sql := a.OriginText()
maxExecutionTime := sctx.GetSessionVars().GetMaxExecutionTime()
maxExecutionTime := getMaxExecutionTime(sctx)
// Update processinfo, ShowProcess() will use it.
pi.SetProcessInfo(sql, time.Now(), cmd, maxExecutionTime)
if sctx.GetSessionVars().StmtCtx.StmtType == "" {
Expand Down Expand Up @@ -538,7 +538,6 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) {
var pi processinfoSetter
if raw, ok := sctx.(processinfoSetter); ok {
pi = raw
<<<<<<< HEAD:executor/adapter.go
sql := a.OriginText()
if simple, ok := a.Plan.(*plannercore.Simple); ok && simple.Statement != nil {
if ss, ok := simple.Statement.(ast.SensitiveStmtNode); ok {
Expand All @@ -547,10 +546,6 @@ func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error) {
}
}
maxExecutionTime := getMaxExecutionTime(sctx)
=======
sql := a.getSQLForProcessInfo()
maxExecutionTime := sctx.GetSessionVars().GetMaxExecutionTime()
>>>>>>> 13bff87d08c (variable: unifiy MaxExecuteTime usage and fix some problem (#50915)):pkg/executor/adapter.go
// Update processinfo, ShowProcess() will use it.
if a.Ctx.GetSessionVars().StmtCtx.StmtType == "" {
a.Ctx.GetSessionVars().StmtCtx.StmtType = ast.GetStmtLabel(a.StmtNode)
Expand Down Expand Up @@ -809,6 +804,14 @@ func isNoResultPlan(p plannercore.Plan) bool {
return false
}

// getMaxExecutionTime get the max execution timeout value.
func getMaxExecutionTime(sctx sessionctx.Context) uint64 {
if sctx.GetSessionVars().StmtCtx.HasMaxExecutionTime {
return sctx.GetSessionVars().StmtCtx.MaxExecutionTime
}
return sctx.GetSessionVars().MaxExecutionTime
}

type chunkRowRecordSet struct {
rows []chunk.Row
idx int
Expand Down
4 changes: 0 additions & 4 deletions expression/builtin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,11 +922,7 @@ func (b *builtinTiDBDecodeSQLDigestsSig) evalString(row chunk.Row) (string, bool

// Querying may take some time and it takes a context.Context as argument, which is not available here.
// We simply create a context with a timeout here.
<<<<<<< HEAD:expression/builtin_info.go
timeout := time.Duration(b.ctx.GetSessionVars().MaxExecutionTime) * time.Millisecond
=======
timeout := time.Duration(ctx.GetSessionVars().GetMaxExecutionTime()) * time.Millisecond
>>>>>>> 13bff87d08c (variable: unifiy MaxExecuteTime usage and fix some problem (#50915)):pkg/expression/builtin_info.go
if timeout == 0 || timeout > 20*time.Second {
timeout = 20 * time.Second
}
Expand Down
309 changes: 0 additions & 309 deletions pkg/planner/core/plan_stats.go

This file was deleted.

Loading

0 comments on commit e011549

Please sign in to comment.