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
planner: unify the Compile and CompileExecStmt functions #37065
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/aa06119cba5e53578122e8f0a93d7a9197c8e955 |
This reverts commit 762f07e.
Before:
After
|
|
||
sctx := a.Ctx | ||
cmd32 := atomic.LoadUint32(&sctx.GetSessionVars().CommandValue) | ||
cmd := byte(cmd32) | ||
var pi processinfoSetter | ||
if raw, ok := sctx.(processinfoSetter); ok { | ||
pi = raw | ||
sql := a.OriginText() | ||
maxExecutionTime := getMaxExecutionTime(sctx) | ||
// Update processinfo, ShowProcess() will use it. | ||
pi.SetProcessInfo(sql, time.Now(), cmd, maxExecutionTime) | ||
if sctx.GetSessionVars().StmtCtx.StmtType == "" { | ||
sctx.GetSessionVars().StmtCtx.StmtType = GetStmtLabel(a.StmtNode) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is copied from the ExecStmt.Exec
. We should set the process information here or we will failed to get the result for explain for connection ...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is short path. It only do the little things.(compare to rumStmt
). We will refactor those part in the later PR.
durCompile := time.Since(s.sessionVars.StartTime) | ||
s.GetSessionVars().DurationCompile = durCompile | ||
|
||
stmtCtx := s.GetSessionVars().StmtCtx | ||
stmt.Text = preparedObj.PreparedAst.Stmt.Text() | ||
stmtCtx.OriginalSQL = stmt.Text | ||
stmtCtx.InitSQLDigest(preparedObj.NormalizedSQL, preparedObj.SQLDigest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is copied from the deleted function CompileExecutePreparedStmt
.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: aa06119
|
TiDB MergeCI notify
|
What problem does this PR solve?
Issue Number: ref #36598
Problem Summary:
Unify the Compile and CompileExecStmt functions.
What is changed and how it works?
Merge two code path to one. Remove the compileExecStmt function.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.