Skip to content

Commit

Permalink
more tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
shanth96 committed Aug 8, 2024
1 parent 9b157b7 commit bc93ac7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ func (e *Executor) getPlan(
return nil, err
}

normalSpan, ctx := trace.NewSpan(ctx, "getPlan.normalize")
// Normalize if possible
shouldNormalize := e.canNormalizeStatement(stmt, setVarComment)
parameterize := allowParameterization && shouldNormalize
Expand All @@ -1103,6 +1104,7 @@ func (e *Executor) getPlan(
if err != nil {
return nil, err
}
normalSpan.Finish()
stmt = rewriteASTResult.AST
bindVarNeeds := rewriteASTResult.BindVarNeeds
if shouldNormalize {
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/plan_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (e *Executor) newExecute(
var lastVSchemaCreated time.Time
vs := e.VSchema()
lastVSchemaCreated = vs.GetCreated()
step2Span.Finish()
for try := 0; try < MaxBufferingRetries; try++ {
if try > 0 && !vs.GetCreated().After(lastVSchemaCreated) {
// There is a race due to which the executor's vschema may not have been updated yet.
Expand All @@ -105,7 +106,6 @@ func (e *Executor) newExecute(
if err != nil {
return err
}
step2Span.Finish()

// 3: Create a plan for the query
// If we are retrying, it is likely that the routing rules have changed and hence we need to
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/query_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (qe *QueryEngine) getPlan(curSchema *currentSchema, sql string) (*TabletPla

// GetPlan returns the TabletPlan that for the query. Plans are cached in an LRU cache.
func (qe *QueryEngine) GetPlan(ctx context.Context, logStats *tabletenv.LogStats, sql string, skipQueryPlanCache bool) (*TabletPlan, error) {
span, _ := trace.NewSpan(ctx, "QueryEngine.GetPlan")
span, ctx := trace.NewSpan(ctx, "QueryEngine.GetPlan")
defer span.Finish()

var plan *TabletPlan
Expand Down

0 comments on commit bc93ac7

Please sign in to comment.