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

*: remove duplicate prefix for last query info (#50075) #52704

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,41 @@ func (a *ExecStmt) FinishExecuteStmt(txnTS uint64, err error, hasMoreResults boo
}
}

<<<<<<< HEAD:executor/adapter.go
=======
func (a *ExecStmt) recordLastQueryInfo(err error) {
sessVars := a.Ctx.GetSessionVars()
// Record diagnostic information for DML statements
recordLastQuery := false
switch typ := a.StmtNode.(type) {
case *ast.ShowStmt:
recordLastQuery = typ.Tp != ast.ShowSessionStates
case *ast.ExecuteStmt, ast.DMLNode:
recordLastQuery = true
}
if recordLastQuery {
var lastRUConsumption float64
if ruDetailRaw := a.GoCtx.Value(util.RUDetailsCtxKey); ruDetailRaw != nil {
ruDetail := ruDetailRaw.(*util.RUDetails)
lastRUConsumption = ruDetail.RRU() + ruDetail.WRU()
}
failpoint.Inject("mockRUConsumption", func(_ failpoint.Value) {
lastRUConsumption = float64(len(sessVars.StmtCtx.OriginalSQL))
})
// Keep the previous queryInfo for `show session_states` because the statement needs to encode it.
sessVars.LastQueryInfo = sessionstates.QueryInfo{
TxnScope: sessVars.CheckAndGetTxnScope(),
StartTS: sessVars.TxnCtx.StartTS,
ForUpdateTS: sessVars.TxnCtx.GetForUpdateTS(),
RUConsumption: lastRUConsumption,
}
if err != nil {
sessVars.LastQueryInfo.ErrMsg = err.Error()
}
}
}

>>>>>>> 7a8d82eddb2 (*: remove duplicate prefix for last query info (#50075)):pkg/executor/adapter.go
func (a *ExecStmt) checkPlanReplayerCapture(txnTS uint64) {
if kv.GetInternalSourceType(a.GoCtx) == kv.InternalTxnStats {
return
Expand Down
Loading